Add account/user/ test for GET

This commit is contained in:
Виктор Гладких 2019-09-23 15:34:40 +03:00
parent b69822444a
commit 23759974d9

View File

@ -1,11 +1,25 @@
from rest_framework.test import APITestCase
from rest_framework import status
from authorization.tests.tests import get_tokens_for_user
from http.cookies import SimpleCookie
# Create your tests here.
class AccountTests(APITestCase):
def test_default(self):
print("account")
self.assertTrue(False)
url = '/api/web/account/user/'
def setUp(self):
self.data = get_tokens_for_user()
def test_user_url(self):
response = self.client.get(self.url)
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
self.client.cookies = SimpleCookie(
{'access_token': self.data['tokens'].get('access_token'),
'refresh_token': self.data['tokens'].get('access_token')})
response = self.client.get(self.url)
self.assertEqual(response.status_code, status.HTTP_200_OK)