changes for my endpoints
This commit is contained in:
@@ -1004,6 +1004,18 @@ class MyProductsViewTest(APITestCase):
|
||||
# check response
|
||||
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
|
||||
|
||||
def test_auth_user_without_company(self):
|
||||
# Authenticate
|
||||
token = get_tokens_for_user(self.user)
|
||||
self.client.credentials(HTTP_AUTHORIZATION=f"Bearer {token['access']}")
|
||||
|
||||
# Query endpoint
|
||||
response = self.client.get(self.endpoint)
|
||||
payload = response.json()
|
||||
# Assert forbidden code
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertEquals([], payload)
|
||||
|
||||
|
||||
class AdminProductViewSetTest(APITestCase):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user