from apps.service.models import TypeReservation, TypeService from django.test import TestCase # Create your tests here. class TypeReservationTest(TestCase): @classmethod def setUpTestData(cls): TypeReservation.objects.create(name='Reseva Doble', acronym='DC') def test_name_label(self): type_reser = TypeReservation.objects.get(id=1) field_label = type_reser._meta.get_field('name').verbose_name self.assertEqual(field_label, 'name') def test_acronym_label(self): acronym = TypeReservation.objects.get(id=1) field_label = acronym._meta.get_field('acronym').verbose_name self.assertEqual(field_label, 'acronym') def test_name_max_length(self): type_reser = TypeReservation.objects.get(id=1) max_length = type_reser._meta.get_field('name').max_length self.assertEqual(max_length, 100) def test_acronym_max_length(self): acronym = TypeReservation.objects.get(id=1) max_length = acronym._meta.get_field('acronym').max_length self.assertEqual(max_length, 50) class TypeServiceTest(TestCase): @classmethod def setUpTestData(cls): TypeService.objects.create(name='Sencillo', acronym='SC') def test_name_label(self): type_service = TypeService.objects.get(id=1) field_label = type_service._meta.get_field('name').verbose_name self.assertEqual(field_label, 'name') def test_acronym_label(self): acronym = TypeService.objects.get(id=1) field_label = acronym._meta.get_field('acronym').verbose_name self.assertEqual(field_label, 'acronym') def test_name_max_length(self): type_service = TypeService.objects.get(id=1) max_length = type_service._meta.get_field('name').max_length self.assertEqual(max_length, 100) def test_acronym_max_length(self): acronym = TypeService.objects.get(id=1) max_length = acronym._meta.get_field('acronym').max_length self.assertEqual(max_length, 50) class ServiceTest(TestCase): @classmethod def setUpTestData(cls): TypeService.objects.create(name='Sencillo', acronym='SC') class ViewsUrlsTest(TestCase): def test_view_url_exists_at_desired_location_of_typeReservation(self): resp = self.client.get('/service/type_reservation/') self.assertEqual(resp.status_code, 200) def test_view_url_exists_at_desired_location_of_typeService(self): resp = self.client.get('/service/type_service/') self.assertEqual(resp.status_code, 200) def test_view_url_exists_at_desired_location_of_service(self): resp = self.client.get('/service/service/') self.assertEqual(resp.status_code, 200) def test_view_url_exists_at_desired_location_of_booking(self): resp = self.client.get('/service/booking/') self.assertEqual(resp.status_code, 200) def test_view_url_exists_at_desired_location_of_typePay(self): resp = self.client.get('/service/type_pay/') self.assertEqual(resp.status_code, 200) def test_view_url_exists_at_desired_location_of_Pay(self): resp = self.client.get('/service/pay/') self.assertEqual(resp.status_code, 200)