switched my_company and my_products from method to class views

This commit is contained in:
Sam
2021-03-08 12:24:44 +00:00
parent ebd1b6744c
commit ec27937b85
7 changed files with 48 additions and 48 deletions

View File

@@ -946,11 +946,9 @@ class MyProductsViewTest(APITestCase):
# 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['count'], len(payload['results']))
self.assertEquals(len(user_instances), payload['count'])
self.assertEquals(len(user_instances), len(payload))
def test_auth_user_can_paginate_instances(self):
"""authenticated user can paginate instances
@@ -970,8 +968,8 @@ class MyProductsViewTest(APITestCase):
self.assertEqual(response.status_code, status.HTTP_200_OK)
# assert only 2 instances in response
payload = response.json()
self.assertEquals(payload['count'], len(payload['results']))
self.assertEquals(2, payload['count'])
self.assertEquals(payload['count'], self.model.objects.count())
self.assertEquals(2, len(payload['results']))
def test_anon_user_cannot_access(self):
# send in request