Skip to content

Commit

Permalink
[RED] Modify test to fix regis flow.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesSetiawan committed May 28, 2024
1 parent 63092d0 commit 0d73842
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion authentication/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def test_missing_fields(self):
class LoginTest(BaseTestCase):

def test_login_successful(self):
data = {'username': 'testuser', 'password': self.password}
self.user2 = AppUser.objects.create_user(email='[email protected]',username='testuser2',password=self.password, is_verified_user=True)
data = {'username': 'testuser2', 'password': self.password}
response = self.client.post(LOGIN_LINK, json.dumps(data), content_type='application/json')
self.assertEqual(response.status_code, 200)

Expand Down Expand Up @@ -119,6 +120,8 @@ def test_sent_email(self):
self.assertEqual(response.status_code, 200)
self.assertEqual(len(mail.outbox), 1)
self.assertEqual(mail.outbox[0].to, ['[email protected]'])
response = self.client.get(EMAIL_VERIFICATION_LINK)
self.assertEqual(response.status_code, 200)

def test_valid_verification_token(self):
token = account_token.make_token(self.user)
Expand Down Expand Up @@ -158,6 +161,8 @@ def test_sent_email_recover_password(self):
self.assertEqual(response.status_code, 200)
self.assertEqual(len(mail.outbox), 1)
self.assertEqual(mail.outbox[0].to, ['[email protected]'])
response = self.client.post((RECOVER_PASSWORD_LINK), {'email':'[email protected]'})
self.assertEqual(response.status_code, 200)

def test_sent_wrong_email_recover_password(self):
response = self.client.post((RECOVER_PASSWORD_LINK), {'email':'[email protected]'})
Expand Down
2 changes: 1 addition & 1 deletion revelio/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = os.getenv('DEFAULT_FROM_EMAIL')

PASSWORD_RESET_TIMEOUT = 300
PASSWORD_RESET_TIMEOUT = 1500

# Internationalization
# https://docs.djangoproject.com/en/5.0/topics/i18n/
Expand Down
2 changes: 1 addition & 1 deletion revelio/settings_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = os.getenv('DEFAULT_FROM_EMAIL')

PASSWORD_RESET_TIMEOUT = 300
PASSWORD_RESET_TIMEOUT = 1500

# Internationalization
# https://docs.djangoproject.com/en/5.0/topics/i18n/
Expand Down

0 comments on commit 0d73842

Please sign in to comment.