Commit 904ed9a0 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Production Server tests: require user email

Same as with the `User` class, this will be necessary for
SSO logins where the email is the primary identifier.
parent 4d191f5048a1
......@@ -183,7 +183,7 @@ Example:
```
~/heptapod/heptapod-tests $ tox -- --heptapod-prod-server \
--heptapod-prod-group-owner-credentials ID:USERNAME:PASSWORD \
--heptapod-prod-group-owner-credentials ID:USERNAME:EMAIL:PASSWORD \
--heptapod-url https://foss.heptapod.net \
--heptapod-ssh-port 22 \
--heptapod-ssh-user hg
......
......@@ -58,8 +58,9 @@ def pytest_addoption(parser):
help="prod servers only: numeric id, username and "
"password for owner of the group where most of the "
"testing will happen. "
"Provided as colon separated fields, such as "
"123:ftest_owner:s1cre3t.")
"Provided as colon separated fields "
"(id, username, email, password), such as: "
"123:ftest_owner:ftest@heptapod.test:s1cre3t.")
group.addoption('--heptapod-prod-group-id', type=int,
help="prod servers only: numeric id for the group "
"where most projects and subgroups are to be created. "
......
......@@ -520,7 +520,7 @@ class ProductionHeptapod(Heptapod):
def __init__(self, group_owner_credentials, default_group_id,
**kw):
super(ProductionHeptapod, self).__init__(**kw)
user_id, name, pwd = group_owner_credentials.split(':', 2)
user_id, name, email, pwd = group_owner_credentials.split(':', 3)
user_id = int(user_id)
self.default_user_name = name
self.load_instance_cache()
......@@ -528,12 +528,16 @@ class ProductionHeptapod(Heptapod):
if user is None:
user = self.users[name] = User(heptapod=self,
id=user_id,
email=email,
name=name,
password=pwd)
else:
# id and password could have changed since last execution
user.id = user_id
user.password = pwd
# email is not cached but can actually be necessary
# (identifier for SSO login)
user.email = email
self.group_owner = user
self.default_group_id = default_group_id
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment