Skip to content

Commit

Permalink
tests: multiple emails and phone_numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed Oct 2, 2023
1 parent b765328 commit 40b868c
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 40 deletions.
14 changes: 7 additions & 7 deletions demo/demoapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def populate(app):
family_name="Doe",
user_name="admin",
display_name="Jane.D",
emails="[email protected]",
emails=["[email protected]"],
password="admin",
phone_numbers="555-000-000",
phone_numbers=["555-000-000"],
profile_url="https://admin.example",
formatted_address="123, Admin Lane - Gotham City 12345",
street="Admin Lane",
Expand All @@ -42,9 +42,9 @@ def populate(app):
family_name="Doe",
user_name="moderator",
display_name="👮 Jack 👮",
emails="[email protected]",
emails=["[email protected]"],
password="moderator",
phone_numbers="555-000-002",
phone_numbers=["555-000-002"],
profile_url="https://moderator.example",
employee_number="1002",
department_number="west",
Expand All @@ -57,9 +57,9 @@ def populate(app):
family_name="Doe",
user_name="user",
display_name="Johnny",
emails="[email protected]",
emails=["[email protected]"],
password="user",
phone_numbers="555-000-001",
phone_numbers=["555-000-001"],
profile_url="https://user.example",
employee_number="1001",
department_number="west",
Expand All @@ -71,7 +71,7 @@ def populate(app):
given_name="James",
family_name="Doe",
user_name="james",
emails="[email protected]",
emails=["[email protected]"],
)
james.save()

Expand Down
4 changes: 2 additions & 2 deletions tests/backends/ldap/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_object_creation(app, backend):
formatted_name="Doe", # leading space
family_name="Doe",
user_name="user",
emails="[email protected]",
emails=["[email protected]"],
)
assert not user.exists
user.save()
Expand All @@ -41,7 +41,7 @@ def test_dn_when_leading_space_in_id_attribute(testclient, backend):
formatted_name=" Doe", # leading space
family_name=" Doe",
user_name=" user",
emails="[email protected]",
emails=["[email protected]"],
)
user.save()

Expand Down
24 changes: 12 additions & 12 deletions tests/backends/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,34 +135,34 @@ def test_model_indexation(testclient, backend):

assert models.User.get(family_name="family_name") == user
assert not models.User.get(family_name="new_family_name")
assert models.User.get(emails="[email protected]") == user
assert models.User.get(emails="[email protected]") == user
assert not models.User.get(emails="[email protected]")
assert models.User.get(emails=["[email protected]"]) == user
assert models.User.get(emails=["[email protected]"]) == user
assert not models.User.get(emails=["[email protected]"])

user.family_name = "new_family_name"
user.emails = ["[email protected]"]

assert models.User.get(family_name="family_name") != user
assert not models.User.get(family_name="new_family_name")
assert models.User.get(emails="[email protected]") != user
assert models.User.get(emails="[email protected]") != user
assert not models.User.get(emails="[email protected]")
assert models.User.get(emails=["[email protected]"]) != user
assert models.User.get(emails=["[email protected]"]) != user
assert not models.User.get(emails=["[email protected]"])

user.save()

assert not models.User.get(family_name="family_name")
assert models.User.get(family_name="new_family_name") == user
assert not models.User.get(emails="[email protected]")
assert models.User.get(emails="[email protected]") == user
assert not models.User.get(emails="[email protected]")
assert not models.User.get(emails=["[email protected]"])
assert models.User.get(emails=["[email protected]"]) == user
assert not models.User.get(emails=["[email protected]"])

user.delete()

assert not models.User.get(family_name="family_name")
assert not models.User.get(family_name="new_family_name")
assert not models.User.get(emails="[email protected]")
assert not models.User.get(emails="[email protected]")
assert not models.User.get(emails="[email protected]")
assert not models.User.get(emails=["[email protected]"])
assert not models.User.get(emails=["[email protected]"])
assert not models.User.get(emails=["[email protected]"])


def test_fuzzy(user, moderator, admin, backend):
Expand Down
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ def user(app, backend):
given_name="John",
family_name="Doe",
user_name="user",
emails="[email protected]",
emails=["[email protected]"],
password="correct horse battery staple",
display_name="Johnny",
preferred_language="en",
phone_numbers="555-000-000",
phone_numbers=["555-000-000"],
profile_url="https://john.example",
formatted_address="1235, somewhere",
)
Expand All @@ -162,7 +162,7 @@ def admin(app, backend):
formatted_name="Jane Doe",
family_name="Doe",
user_name="admin",
emails="[email protected]",
emails=["[email protected]"],
password="admin",
)
u.save()
Expand All @@ -177,7 +177,7 @@ def moderator(app, backend):
formatted_name="Jack Doe",
family_name="Doe",
user_name="moderator",
emails="[email protected]",
emails=["[email protected]"],
password="moderator",
)
u.save()
Expand Down
12 changes: 6 additions & 6 deletions tests/core/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def test_first_login_account_initialization_mail_sending_failed(
formatted_name="Temp User",
family_name="Temp",
user_name="temp",
emails="[email protected]",
emails=["[email protected]"],
)
u.save()

Expand All @@ -185,7 +185,7 @@ def test_first_login_form_error(testclient, backend, smtpd):
formatted_name="Temp User",
family_name="Temp",
user_name="temp",
emails="[email protected]",
emails=["[email protected]"],
)
u.save()

Expand All @@ -207,7 +207,7 @@ def test_user_password_deleted_during_login(testclient, backend):
formatted_name="Temp User",
family_name="Temp",
user_name="temp",
emails="[email protected]",
emails=["[email protected]"],
password="correct horse battery staple",
)
u.save()
Expand All @@ -231,7 +231,7 @@ def test_user_deleted_in_session(testclient, backend):
formatted_name="Jake Doe",
family_name="Jake",
user_name="jake",
emails="[email protected]",
emails=["[email protected]"],
password="correct horse battery staple",
)
u.save()
Expand Down Expand Up @@ -290,7 +290,7 @@ def test_admin_self_deletion(testclient, backend):
formatted_name="Temp admin",
family_name="admin",
user_name="temp",
emails="[email protected]",
emails=["[email protected]"],
password="admin",
)
admin.save()
Expand All @@ -316,7 +316,7 @@ def test_user_self_deletion(testclient, backend):
formatted_name="Temp user",
family_name="user",
user_name="temp",
emails="[email protected]",
emails=["[email protected]"],
password="correct horse battery staple",
)
user.save()
Expand Down
4 changes: 2 additions & 2 deletions tests/core/test_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_group_deletion(testclient, backend):
formatted_name="foobar",
family_name="foobar",
user_name="foobar",
emails="[email protected]",
emails=["[email protected]"],
)
user.save()

Expand Down Expand Up @@ -111,7 +111,7 @@ def test_set_groups_with_leading_space_in_user_id_attribute(app, foo_group):
formatted_name=" Doe", # leading space in id attribute
family_name="Doe",
user_name="user2",
emails="[email protected]",
emails=["[email protected]"],
)
user.save()

Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_user_has_password(testclient, backend):
formatted_name="Temp User",
family_name="Temp",
user_name="temp",
emails="[email protected]",
emails=["[email protected]"],
)
u.save()

Expand Down
8 changes: 4 additions & 4 deletions tests/core/test_profile_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def test_password_initialization_mail(smtpd, testclient, backend, logged_admin):
formatted_name="Temp User",
family_name="Temp",
user_name="temp",
emails="[email protected]",
emails=["[email protected]"],
)
u.save()

Expand Down Expand Up @@ -166,7 +166,7 @@ def test_password_initialization_mail_send_fail(
formatted_name="Temp User",
family_name="Temp",
user_name="temp",
emails="[email protected]",
emails=["[email protected]"],
)
u.save()

Expand Down Expand Up @@ -236,7 +236,7 @@ def test_password_reset_email(smtpd, testclient, backend, logged_admin):
formatted_name="Temp User",
family_name="Temp",
user_name="temp",
emails="[email protected]",
emails=["[email protected]"],
password="correct horse battery staple",
)
u.save()
Expand Down Expand Up @@ -264,7 +264,7 @@ def test_password_reset_email_failed(SMTP, smtpd, testclient, backend, logged_ad
formatted_name="Temp User",
family_name="Temp",
user_name="temp",
emails="[email protected]",
emails=["[email protected]"],
password=["correct horse battery staple"],
)
u.save()
Expand Down
4 changes: 2 additions & 2 deletions tests/oidc/test_authorization_code_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ def test_code_with_invalid_user(testclient, admin, client):
formatted_name="John Doe",
family_name="Doe",
user_name="temp",
emails="[email protected]",
emails=["[email protected]"],
password="correct horse battery staple",
)
user.save()
Expand Down Expand Up @@ -876,7 +876,7 @@ def test_refresh_token_with_invalid_user(testclient, client):
formatted_name="John Doe",
family_name="Doe",
user_name="temp",
emails="[email protected]",
emails=["[email protected]"],
password="correct horse battery staple",
)
user.save()
Expand Down

0 comments on commit 40b868c

Please sign in to comment.