Add account/user/ test for GET
This commit is contained in:
parent
b69822444a
commit
23759974d9
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user