Add class to test childs
This commit is contained in:
parent
ee93905556
commit
e616d3970c
|
|
@ -65,19 +65,25 @@ class EmployeeTests(BaseTestCase):
|
|||
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class EmailTests(BaseTestCase):
|
||||
def test_email_CRD(self):
|
||||
response = self.client.get('/api/back/establishments/emails/', format='json')
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
establishment = Establishment.objects.create(
|
||||
# Class to test childs
|
||||
class ChildTestCase(BaseTestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.establishment = Establishment.objects.create(
|
||||
name="Test establishment",
|
||||
establishment_type_id=self.establishment_type.id
|
||||
)
|
||||
|
||||
|
||||
# Test childs
|
||||
class EmailTests(ChildTestCase):
|
||||
def test_email_CRD(self):
|
||||
response = self.client.get('/api/back/establishments/emails/', format='json')
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
data = {
|
||||
'email': "test@test.com",
|
||||
'establishment': establishment.id
|
||||
'establishment': self.establishment.id
|
||||
}
|
||||
|
||||
response = self.client.post('/api/back/establishments/emails/', data=data)
|
||||
|
|
@ -90,19 +96,14 @@ class EmailTests(BaseTestCase):
|
|||
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class PhoneTests(BaseTestCase):
|
||||
class PhoneTests(ChildTestCase):
|
||||
def test_phone_CRD(self):
|
||||
response = self.client.get('/api/back/establishments/phones/', format='json')
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
establishment = Establishment.objects.create(
|
||||
name="Test establishment",
|
||||
establishment_type_id=self.establishment_type.id
|
||||
)
|
||||
|
||||
data = {
|
||||
'phone': "+79999999999",
|
||||
'establishment': establishment.id
|
||||
'establishment': self.establishment.id
|
||||
}
|
||||
|
||||
response = self.client.post('/api/back/establishments/phones/', data=data)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user