diff --git a/social_core/tests/actions/test_login.py b/social_core/tests/actions/test_login.py index 86925019..3caa4477 100644 --- a/social_core/tests/actions/test_login.py +++ b/social_core/tests/actions/test_login.py @@ -4,6 +4,14 @@ class LoginActionTest(BaseActionTest): + def setUp(self): + super().setUp() + User.set_authenticated(False) + + def tearDown(self): + super().tearDown() + User.set_authenticated(True) + def test_login(self): self.do_login() diff --git a/social_core/tests/models.py b/social_core/tests/models.py index f49a7465..7a30995a 100644 --- a/social_core/tests/models.py +++ b/social_core/tests/models.py @@ -23,6 +23,7 @@ class User(BaseModel): NEXT_ID = 1 cache = {} _is_active = True + _is_authenticated = True def __init__(self, username, email=None, **extra_user_fields): self.id = User.next_id() @@ -39,10 +40,17 @@ def __init__(self, username, email=None, **extra_user_fields): def is_active(self): return self._is_active + def is_authenticated(self): + return self._is_authenticated + @classmethod def set_active(cls, is_active=True): cls._is_active = is_active + @classmethod + def set_authenticated(cls, is_authenticated=True): + cls._is_authenticated = is_authenticated + def set_password(self, password): self.password = password