switched my_company and my_products from method to class views
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user