mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
actually run tests, for a change
This commit is contained in:
parent
96ecd2640a
commit
1a43198cb7
@ -38,7 +38,7 @@ class APITests(InvenTreeAPITestCase):
|
|||||||
auth = b64encode(authstring).decode("ascii")
|
auth = b64encode(authstring).decode("ascii")
|
||||||
self.client.credentials(HTTP_AUTHORIZATION="Basic {auth}".format(auth=auth))
|
self.client.credentials(HTTP_AUTHORIZATION="Basic {auth}".format(auth=auth))
|
||||||
|
|
||||||
def tokenAuth(self):
|
def test_tokenAuth(self):
|
||||||
|
|
||||||
self.basicAuth()
|
self.basicAuth()
|
||||||
token_url = reverse('api-token')
|
token_url = reverse('api-token')
|
||||||
@ -50,7 +50,7 @@ class APITests(InvenTreeAPITestCase):
|
|||||||
token = response.data['token']
|
token = response.data['token']
|
||||||
self.token = token
|
self.token = token
|
||||||
|
|
||||||
def token_failure(self):
|
def test_token_failure(self):
|
||||||
# Test token endpoint without basic auth
|
# Test token endpoint without basic auth
|
||||||
url = reverse('api-token')
|
url = reverse('api-token')
|
||||||
response = self.client.get(url, format='json')
|
response = self.client.get(url, format='json')
|
||||||
@ -58,7 +58,7 @@ class APITests(InvenTreeAPITestCase):
|
|||||||
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
|
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
|
||||||
self.assertIsNone(self.token)
|
self.assertIsNone(self.token)
|
||||||
|
|
||||||
def token_success(self):
|
def test_token_success(self):
|
||||||
|
|
||||||
self.tokenAuth()
|
self.tokenAuth()
|
||||||
self.assertIsNotNone(self.token)
|
self.assertIsNotNone(self.token)
|
||||||
|
Loading…
Reference in New Issue
Block a user