Skip to content
Snippets Groups Projects
Commit 5113c8dc authored by robinwilliam.hundt's avatar robinwilliam.hundt
Browse files

Added /api-token-auth/ endpoint test

Also set TEST_REQUEST_DEFAULT_FORMAT to json in default.py
parent 62436005
No related branches found
No related tags found
1 merge request!16Backend tests
Pipeline #
from rest_framework.test import APIClient, APITestCase
from core.models import UserAccount
class AuthTests(APITestCase):
@classmethod
def setUpTestData(cls):
cls.user = UserAccount.objects.create(username='user')
cls.user.set_password('p')
cls.user.save()
cls.client = APIClient()
def test_get_token(self):
response = self.client.post('/api-token-auth/',
{'username': 'user',
'password': 'p'}, format='json')
self.assertContains(response, 'token')
......@@ -154,6 +154,7 @@ REST_FRAMEWORK = {
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication',
),
'TEST_REQUEST_DEFAULT_FORMAT': 'json',
}
JWT_AUTH = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment