Add plate tests
Add is_publish to serializer Add TODO for is_publish
This commit is contained in:
parent
e616d3970c
commit
014931d2c4
|
|
@ -34,7 +34,9 @@ class EstablishmentListCreateSerializer(EstablishmentBaseSerializer):
|
|||
'type_id',
|
||||
'type',
|
||||
'socials',
|
||||
'image_url'
|
||||
'image_url',
|
||||
# TODO: check in admin filters
|
||||
'is_publish'
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,20 +28,19 @@ class EstablishmentTests(BaseTestCase):
|
|||
response = self.client.get('/api/back/establishments/', format='json')
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
|
||||
|
||||
data = {
|
||||
'name': 'Test establishment',
|
||||
'type_id': self.establishment_type.id,
|
||||
'is_publish': True
|
||||
}
|
||||
|
||||
response = self.client.post('/api/back/establishments/', data=data, format='json')
|
||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||
|
||||
response = self.client.get('/api/back/establishments/1/', format='json')
|
||||
response = self.client.get('/api/back/establishments/2/', format='json')
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
response = self.client.delete('/api/back/establishments/1/', format='json')
|
||||
response = self.client.delete('/api/back/establishments/2/', format='json')
|
||||
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
|
|
@ -71,7 +70,8 @@ class ChildTestCase(BaseTestCase):
|
|||
super().setUp()
|
||||
self.establishment = Establishment.objects.create(
|
||||
name="Test establishment",
|
||||
establishment_type_id=self.establishment_type.id
|
||||
establishment_type_id=self.establishment_type.id,
|
||||
is_publish=True
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -114,3 +114,46 @@ class PhoneTests(ChildTestCase):
|
|||
|
||||
response = self.client.delete('/api/back/establishments/phones/1/')
|
||||
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class SocialTests(ChildTestCase):
|
||||
def test_social_CRD(self):
|
||||
response = self.client.get('/api/back/establishments/socials/', format='json')
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
data = {
|
||||
'title': "Test social",
|
||||
'url': 'https://testsocial.com',
|
||||
'establishment': self.establishment.id
|
||||
}
|
||||
|
||||
response = self.client.post('/api/back/establishments/socials/', data=data)
|
||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||
|
||||
response = self.client.get('/api/back/establishments/socials/1/', format='json')
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
response = self.client.delete('/api/back/establishments/socials/1/')
|
||||
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class PlatesTests(ChildTestCase):
|
||||
def test_plates_CRD(self):
|
||||
response = self.client.get('/api/back/establishments/plates/', format='json')
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
data = {
|
||||
'title': "Test social",
|
||||
'url': 'https://testsocial.com',
|
||||
'establishment': self.establishment.id
|
||||
}
|
||||
|
||||
response = self.client.post('/api/back/establishments/plates/', data=data)
|
||||
print(f"PLATE: {response.json()}")
|
||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||
|
||||
response = self.client.get('/api/back/establishments/plates/1/', format='json')
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
response = self.client.delete('/api/back/establishments/plates/1/')
|
||||
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user