Refactor test code
This commit is contained in:
parent
7f630e9e94
commit
199ca1fa77
|
|
@ -3,13 +3,12 @@ from rest_framework import status
|
||||||
from authorization.tests.tests import get_tokens_for_user
|
from authorization.tests.tests import get_tokens_for_user
|
||||||
from http.cookies import SimpleCookie
|
from http.cookies import SimpleCookie
|
||||||
from account.models import User
|
from account.models import User
|
||||||
from os import path
|
from django.urls import reverse
|
||||||
# Create your tests here.
|
|
||||||
|
|
||||||
|
|
||||||
class AccountUserTests(APITestCase):
|
class AccountUserTests(APITestCase):
|
||||||
|
|
||||||
url = '/api/web/account/user/'
|
url = reverse('web:account:user-retrieve-update')
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.data = get_tokens_for_user()
|
self.data = get_tokens_for_user()
|
||||||
|
|
@ -44,7 +43,8 @@ class AccountUserTests(APITestCase):
|
||||||
|
|
||||||
|
|
||||||
class AccountChangePasswordTests(APITestCase):
|
class AccountChangePasswordTests(APITestCase):
|
||||||
url = '/api/web/account/change-password/'
|
|
||||||
|
url = reverse('web:account:change-password')
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.data = get_tokens_for_user()
|
self.data = get_tokens_for_user()
|
||||||
|
|
@ -67,16 +67,16 @@ class AccountChangePasswordTests(APITestCase):
|
||||||
|
|
||||||
|
|
||||||
class AccountChangePasswordTests(APITestCase):
|
class AccountChangePasswordTests(APITestCase):
|
||||||
# "/web/account/email/confirm/{uidb64}/{token}/"
|
|
||||||
url = "/api/web/account/email/confirm/"
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.data = get_tokens_for_user()
|
self.data = get_tokens_for_user()
|
||||||
|
|
||||||
def test_confirm_email(self):
|
def test_confirm_email(self):
|
||||||
user = User.objects.get(email=self.data["email"])
|
user = User.objects.get(email=self.data["email"])
|
||||||
token = user.confirm_email_token
|
token = user.confirm_email_token
|
||||||
uid64 = user.get_user_uidb64
|
uidb64 = user.get_user_uidb64
|
||||||
url = path.join(self.url, uid64, token, "")
|
url = reverse('web:account:confirm-email', kwargs={
|
||||||
|
'uidb64': uidb64,
|
||||||
|
'token': token
|
||||||
|
})
|
||||||
response = self.client.get(url)
|
response = self.client.get(url)
|
||||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||||
Loading…
Reference in New Issue
Block a user