-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
33535ee
commit b83734c
Showing
5 changed files
with
19 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,26 +8,23 @@ class ForgotPasswordTest(APITestCase): | |
def setUp(self): | ||
|
||
self.user = User.objects.create( | ||
username="Akromjon", | ||
username="Akromjon", | ||
email="[email protected]", | ||
password="password", | ||
is_active=True | ||
is_active=True, | ||
) | ||
|
||
refres_token = RefreshToken.for_user(self.user) | ||
self.token = str(refres_token.access_token) | ||
|
||
|
||
def test_forgot(self): | ||
url = reverse("users:forgot-password") | ||
|
||
self.client.credentials(HTTP_AUTHORIZATION="Bearer " + self.token) | ||
|
||
data={"email": "[email protected]"} | ||
data = {"email": "[email protected]"} | ||
|
||
response = self.client.post( | ||
url, data=data | ||
) | ||
response = self.client.post(url, data=data) | ||
self.assertEqual(response.status_code, 200) | ||
self.assertEqual( | ||
response.json()["detail"], | ||
|
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 |
---|---|---|
|
@@ -7,19 +7,16 @@ | |
class UpdatePasswordTest(APITestCase): | ||
def setUp(self): | ||
self.user = User.objects.create( | ||
username="Akromjon", | ||
username="Akromjon", | ||
email="[email protected]", | ||
password="password", | ||
is_active=True | ||
is_active=True, | ||
) | ||
refresh_token = RefreshToken.for_user(self.user) | ||
self.token = str(refresh_token.access_token) | ||
|
||
|
||
def test_update(self): | ||
url = reverse( | ||
"users:user-password-update", kwargs={"token": self.user.token} | ||
) | ||
url = reverse("users:user-password-update", kwargs={"token": self.user.token}) | ||
self.client.credentials(HTTP_AUTHORIZATION="Bearer " + self.token) | ||
data = { | ||
"password1": "2007", | ||
|
@@ -28,6 +25,5 @@ def test_update(self): | |
"new_password": "0000", | ||
} | ||
response = self.client.put(url, data=data) | ||
|
||
self.assertEqual(response.status_code, 200) | ||
|
||
self.assertEqual(response.status_code, 200) |
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 |
---|---|---|
|
@@ -7,19 +7,17 @@ | |
class UserActivateTest(APITestCase): | ||
def setUp(self): | ||
self.user = User.objects.create( | ||
username="Akrom", | ||
username="Akrom", | ||
email="[email protected]", | ||
password="password", | ||
is_active=True | ||
is_active=True, | ||
) | ||
refresh_token = RefreshToken.for_user(self.user) | ||
self.token = str(refresh_token.access_token) | ||
|
||
def test_activation(self): | ||
activation_user = User.objects.create( | ||
username="Munisa", | ||
email="[email protected]", | ||
password="password" | ||
username="Munisa", email="[email protected]", password="password" | ||
) | ||
self.client.credentials(HTTP_AUTHORIZATION="Bearer " + self.token) | ||
url = reverse("users:user-activation", kwargs={"token": activation_user.token}) | ||
|
@@ -28,5 +26,6 @@ def test_activation(self): | |
|
||
self.assertEqual(response.status_code, 200) | ||
self.assertEqual( | ||
response.json()["detail"], f"{activation_user.username} successfully activated" | ||
response.json()["detail"], | ||
f"{activation_user.username} successfully activated", | ||
) |
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 |
---|---|---|
|
@@ -14,13 +14,13 @@ def setUp(self) -> None: | |
username="Akromjon", | ||
email="[email protected]", | ||
password="2007", | ||
is_active=True | ||
is_active=True, | ||
) | ||
refresh_token = RefreshToken.for_user(self.user) | ||
self.token = str(refresh_token.access_token) | ||
|
||
def test_create(self): | ||
self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.token) | ||
self.client.credentials(HTTP_AUTHORIZATION="Bearer " + self.token) | ||
url = reverse("users:user-create") | ||
for _ in range(5): | ||
password = fake.password() | ||
|