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

@@ -311,6 +311,9 @@ class MyCompanyViewTest(APITestCase):
self.user.set_password(self.password)
self.user.save()
def tearDown(self):
self.model.objects.all().delete()
def test_auth_user_gets_data(self):
# create instance
user_instances = [self.factory(creator=self.user) for i in range(5)]
@@ -346,7 +349,7 @@ class MyCompanyViewTest(APITestCase):
self.assertEqual(response.status_code, status.HTTP_200_OK)
# assert only 2 instances in response
payload = response.json()
self.assertEquals(2, len(payload))
self.assertEquals(2, len(payload['results']))
def test_anon_user_cannot_access(self):
# send in request