Skip to content

Commit 928431d

Browse files
author
Ben Rogers-Newsome
committed
Updated tests
All tests were assuming that the user was authenticated, which caused tests to fail now that we are actually checking that the user is authenticated post-pipeline (a none user is obviously not authenticated so pre-pipeline this wasn't causing problems). Mirrored the way that is_active is done.
1 parent 1c072db commit 928431d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

social_core/tests/actions/test_login.py

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55

66
class LoginActionTest(BaseActionTest):
7+
def setUp(self):
8+
super().setUp()
9+
User.set_authenticated(False)
10+
11+
def tearDown(self):
12+
super().tearDown()
13+
User.set_authenticated(True)
14+
715
def test_login(self):
816
self.do_login()
917

social_core/tests/models.py

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class User(BaseModel):
2323
NEXT_ID = 1
2424
cache = {}
2525
_is_active = True
26+
_is_authenticated = True
2627

2728
def __init__(self, username, email=None, **extra_user_fields):
2829
self.id = User.next_id()
@@ -39,10 +40,17 @@ def __init__(self, username, email=None, **extra_user_fields):
3940
def is_active(self):
4041
return self._is_active
4142

43+
def is_authenticated(self):
44+
return self._is_authenticated
45+
4246
@classmethod
4347
def set_active(cls, is_active=True):
4448
cls._is_active = is_active
4549

50+
@classmethod
51+
def set_authenticated(cls, is_authenticated=True):
52+
cls._is_authenticated = is_authenticated
53+
4654
def set_password(self, password):
4755
self.password = password
4856

0 commit comments

Comments
 (0)