mirror of
https://github.com/suitenumerique/meet.git
synced 2026-07-26 11:58:53 +00:00
✅(backend) add test coverage for blank sub behavior
Update the test to document the actual contract without modifying the underlying model behavior. These tests act as non-regression coverage and explicitly assert that users may have a null sub or email. They are intended to document the current behavior of the initial user model rather than evolve or constrain it. Ghost rows have not been reported as an operational issue. For the sake of simplicity, avoid changing the model unless required by a concrete issue or unless the benefits clearly outweigh the added complexity.
This commit is contained in:
committed by
aleb_the_flash
parent
a8b79740e9
commit
e25aa6ce05
@@ -94,3 +94,23 @@ def test_models_users_sub_null_email_null_does_not_prevent_creation():
|
||||
u1 = factories.UserFactory(sub=None, email=None)
|
||||
u2 = factories.UserFactory(sub=None, email=None)
|
||||
assert u1.pk != u2.pk
|
||||
|
||||
|
||||
def test_models_users_sub_can_be_null():
|
||||
"""sub is nullable: pending users exist before OIDC activation."""
|
||||
user = factories.UserFactory(sub=None)
|
||||
user.refresh_from_db()
|
||||
assert user.sub is None
|
||||
|
||||
|
||||
def test_models_users_sub_null_does_not_prevent_creation():
|
||||
"""Multiple users can be created with sub=None (pending state)."""
|
||||
u1 = factories.UserFactory(sub=None)
|
||||
u2 = factories.UserFactory(sub=None)
|
||||
assert u1.pk != u2.pk
|
||||
|
||||
|
||||
def test_models_users_sub_blank_is_accepted():
|
||||
"""sub='' passes validation because blank=True; null is preferred but not enforced."""
|
||||
user = factories.UserFactory.build(sub="")
|
||||
user.full_clean()
|
||||
|
||||
Reference in New Issue
Block a user