-
-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
109338c
commit d92bb66
Showing
1 changed file
with
0 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,6 @@ def test_post_valid_api_user_creation(self): | |
response = self.client.post( | ||
reverse('api_register'), | ||
{'username': 'restapi', 'email': '[email protected]', 'password': 'AekaiLe0ga'}, | ||
Authorization=f'Token {token.key}', | ||
) | ||
count_after = User.objects.count() | ||
self.assertEqual(response.status_code, HTTP_201_CREATED) | ||
|
@@ -91,7 +90,6 @@ def test_post_valid_api_user_creation_no_email(self): | |
response = self.client.post( | ||
reverse('api_register'), | ||
{'username': 'restapi', 'password': 'AekaiLe0ga'}, | ||
Authorization=f'Token {token.key}', | ||
) | ||
count_after = User.objects.count() | ||
self.assertEqual(response.status_code, HTTP_201_CREATED) | ||
|
@@ -102,21 +100,6 @@ def test_post_valid_api_user_creation_no_email(self): | |
self.assertEqual(response.data['token'], token.key) | ||
self.assertEqual(count_after, count_before + 1) | ||
|
||
def test_post_not_allowed_api_user_creation(self): | ||
"""User admin isn't allowed to register users""" | ||
|
||
self.user_login('admin') | ||
count_before = User.objects.count() | ||
|
||
response = self.client.post( | ||
reverse('api_register'), | ||
{'username': 'restapi', 'email': '[email protected]', 'password': 'AekaiLe0ga'}, | ||
) | ||
count_after = User.objects.count() | ||
|
||
self.assertEqual(response.status_code, HTTP_403_FORBIDDEN) | ||
self.assertEqual(count_after, count_before) | ||
|
||
def test_post_unsuccessfully_registration_no_username(self): | ||
"""Test unsuccessful registration (weak password)""" | ||
|
||
|
@@ -127,7 +110,6 @@ def test_post_unsuccessfully_registration_no_username(self): | |
response = self.client.post( | ||
reverse('api_register'), | ||
{'password': 'AekaiLe0ga'}, | ||
Authorization=f'Token {token.key}', | ||
) | ||
|
||
self.assertEqual(response.status_code, HTTP_400_BAD_REQUEST) | ||
|
@@ -142,7 +124,6 @@ def test_post_unsuccessfully_registration_invalid_email(self): | |
response = self.client.post( | ||
reverse('api_register'), | ||
{'username': 'restapi', 'email': 'example.com', 'password': 'AekaiLe0ga'}, | ||
Authorization=f'Token {token.key}', | ||
) | ||
|
||
self.assertEqual(response.status_code, HTTP_400_BAD_REQUEST) | ||
|
@@ -157,7 +138,6 @@ def test_post_unsuccessfully_registration_invalid_email_2(self): | |
response = self.client.post( | ||
reverse('api_register'), | ||
{'username': 'restapi', 'email': '[email protected]', 'password': 'AekaiLe0ga'}, | ||
Authorization=f'Token {token.key}', | ||
) | ||
|
||
self.assertEqual(response.status_code, HTTP_400_BAD_REQUEST) |