diff --git a/backend/core/tests/__init__.py b/backend/core/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/backend/core/tests/test_auth.py b/backend/core/tests/test_auth.py new file mode 100644 index 0000000000000000000000000000000000000000..fd52b6e917992038cb5f543615db66532f61d176 --- /dev/null +++ b/backend/core/tests/test_auth.py @@ -0,0 +1,17 @@ +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') diff --git a/backend/grady/settings/default.py b/backend/grady/settings/default.py index 86e0c94956f52ceb7b459c8d8e015d73c4825a6c..696cd59890a491e6cc09089f17397ddded9e51b9 100644 --- a/backend/grady/settings/default.py +++ b/backend/grady/settings/default.py @@ -154,6 +154,7 @@ REST_FRAMEWORK = { 'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.BasicAuthentication', ), + 'TEST_REQUEST_DEFAULT_FORMAT': 'json', } JWT_AUTH = {