-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Release 7 - 28 December 2022 (#115)
* feat: change status page dashboard query and add forget password validation (#114) * [REFACTOR] update query for status page dashboard * [FIX] fix change password validation * [CHORES] add technical documentation and youtube link * chores: add release notes 7
- Loading branch information
1 parent
2264d34
commit e6497c4
Showing
5 changed files
with
58 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,32 +86,47 @@ def test_if_key_not_exists_then_return_error(self): | |
def test_if_key_exists_but_token_invalid_then_return_error(self): | ||
response = self.client.post(self.test_url, { | ||
'key': 'abc', | ||
'password': 'newpassword', | ||
'password': 'Test123486827', | ||
}, format='json') | ||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | ||
self.assertEqual(response.data, {'error': 'Invalid token'}) | ||
|
||
def test_if_key_exists_and_token_valid__and_pasword_same_as_old_then_return_error(self): | ||
user = User.objects.create_user(username='test', email='[email protected]', password='test123') | ||
user = User.objects.create_user(username='test', email='[email protected]', password='Test123486827') | ||
token = ForgetPasswordToken.objects.create(user=user) | ||
response = self.client.post(self.test_url, { | ||
'key': token.key, | ||
'password': 'test123', | ||
'password': 'Test123486827', | ||
}, format='json') | ||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | ||
self.assertEqual(response.data, {'error': 'Please choose password that different from your current password'}) | ||
|
||
def test_if_key_exists_token_valid_but_invalid_password_then_return_error(self): | ||
user = User.objects.create_user(username='test', email='[email protected]', password='Test123486827') | ||
token = ForgetPasswordToken.objects.create(user=user) | ||
response = self.client.post(self.test_url, { | ||
'key': token.key, | ||
'password': 'abc', | ||
}, format='json') | ||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | ||
self.assertEqual(response.data, {"password": [ | ||
"This password is too short. It must contain at least 8 characters.", | ||
"This password is too common.", | ||
"The password must contain at least 1 digit, 0-9.", | ||
"The password must contain at least 1 uppercase letter, A-Z." | ||
]}) | ||
|
||
def test_if_key_exists_and_token_valid_then_return_success(self): | ||
user = User.objects.create_user(username='test', email='[email protected]', password='test123') | ||
user = User.objects.create_user(username='test', email='[email protected]', password='Test123486827') | ||
token = ForgetPasswordToken.objects.create(user=user) | ||
response = self.client.post(self.test_url, { | ||
'key': token.key, | ||
'password': 'newpassword', | ||
'password': 'Test1234868271', | ||
}, format='json') | ||
self.assertEqual(response.status_code, status.HTTP_200_OK) | ||
self.assertEqual(response.data, {'success': True}) | ||
|
||
user = User.objects.get(email='[email protected]') | ||
self.assertTrue(user.check_password('newpassword')) | ||
self.assertTrue(user.check_password('Test1234868271')) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters