Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

♻️(backend) isolate authentication tests when dealing only with email

lebaudantoine0fd06ef6c04e
diff --git a/src/backend/core/tests/authentication/test_backends.py b/src/backend/core/tests/authentication/test_backends.py
index c2a65d24..73600f43 100644
--- a/src/backend/core/tests/authentication/test_backends.py
+++ b/src/backend/core/tests/authentication/test_backends.py
@@ -62,15 +62,14 @@ def test_authentication_getter_new_user_no_email(monkeypatch):
def test_authentication_getter_new_user_with_email(monkeypatch):
"""
If no user matches, a user should be created.
- User's email and name should be set on the identity.
- The "email" field on the User model should not be set as it is reserved for staff users.
+ User's info contains an email, created user's email should be filled.
"""
klass = OIDCAuthenticationBackend()
def get_userinfo_mocked(*args):
- return {"sub": "123", "email": email, "first_name": "John", "last_name": "Doe"}
+ return {"sub": "123", "email": email}
monkeypatch.setattr(OIDCAuthenticationBackend, "get_userinfo", get_userinfo_mocked)
@@ -80,6 +79,8 @@ def test_authentication_getter_new_user_with_email(monkeypatch):
assert user.sub == "123"
assert user.email == email
+ assert user.full_name is None
+ assert user.short_name is None
assert user.password == "!"
assert models.User.objects.count() == 1