diff --git a/apps/account/tests/tests_common.py b/apps/account/tests/tests_common.py index fcabe946..2e66b330 100644 --- a/apps/account/tests/tests_common.py +++ b/apps/account/tests/tests_common.py @@ -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) +