Fix all test
This commit is contained in:
parent
ac8356c7d1
commit
4d113a6916
|
|
@ -22,7 +22,7 @@ class EstablishmentListCreateSerializer(EstablishmentBaseSerializer):
|
|||
emails = ContactEmailsSerializer(read_only=True, many=True, )
|
||||
socials = SocialNetworkRelatedSerializers(read_only=True, many=True, )
|
||||
slug = serializers.SlugField(required=True, allow_blank=False, max_length=50)
|
||||
type = EstablishmentTypeSerializer(source='establishment_type')
|
||||
type = EstablishmentTypeSerializer(source='establishment_type', read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = models.Establishment
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from http.cookies import SimpleCookie
|
|||
from main.models import Currency
|
||||
from establishment.models import Establishment, EstablishmentType, Menu
|
||||
# Create your tests here.
|
||||
from translation.models import Language
|
||||
|
||||
|
||||
class BaseTestCase(APITestCase):
|
||||
|
|
@ -25,6 +26,12 @@ class BaseTestCase(APITestCase):
|
|||
|
||||
self.establishment_type = EstablishmentType.objects.create(name="Test establishment type")
|
||||
|
||||
# Create lang object
|
||||
Language.objects.create(
|
||||
title='English',
|
||||
locale='en-GB'
|
||||
)
|
||||
|
||||
|
||||
class EstablishmentBTests(BaseTestCase):
|
||||
def test_establishment_CRUD(self):
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ class BaseAttributeTests(BaseTestCase):
|
|||
|
||||
response_data = response.json()
|
||||
self.assertIn("id", response_data)
|
||||
self.assertIsInstance(response_data['id'], int)
|
||||
|
||||
employee = Employee.objects.get(id=response_data['id'])
|
||||
|
||||
|
|
@ -118,7 +119,7 @@ class BaseAttributeTests(BaseTestCase):
|
|||
'name': 'Test new name'
|
||||
}
|
||||
|
||||
response = self.client.patch('/api/back/establishments/employees/1/', data=update_data)
|
||||
response = self.client.patch(f'/api/back/establishments/employees/{employee.pk}/', data=update_data)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
employee.refresh_from_db()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user