Update tests

Update view
This commit is contained in:
littlewolf 2019-09-27 07:52:57 +03:00
parent 5793eaad32
commit 4f2bca78f9
2 changed files with 16 additions and 13 deletions

View File

@ -89,17 +89,20 @@ class CollectionWebHomeTests(CollectionDetailTests):
super().setUp() super().setUp()
self.establishment_type = EstablishmentType.objects.create(name="Test establishment type") self.establishment_type = EstablishmentType.objects.create(name="Test establishment type")
self.establishment = Establishment.objects.create( for i in range(1, 5):
name="Test establishment", setattr(self, f"establishment{i}",
Establishment.objects.create(
name=f"Test establishment {i}",
establishment_type_id=self.establishment_type.id, establishment_type_id=self.establishment_type.id,
is_publish=True, is_publish=True,
slug="test" slug=f"test-establishment-{i}"
)
) )
self.establishment.collections.add(self.collection) getattr(self, f"establishment{i}").collections.add(self.collection)
self.establishment.save()
def test_collection_list_filter(self): def test_collection_list_filter(self):
print("========================================================================================") response = self.client.get('/api/web/collections/?country_code=en', format='json')
response = self.client.get('/api/web/collections/', format='json') data = response.json()
self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertIn('count', data)
self.assertGreater(data['count'], 0)