diff --git a/apps/hotel/__pycache__/tests.cpython-39.pyc b/apps/hotel/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..d5feaf2 --- /dev/null +++ b/apps/hotel/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/hotel/__pycache__/tests.cpython-39.pyc b/apps/hotel/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..d5feaf2 --- /dev/null +++ b/apps/hotel/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/hotel/__pycache__/views.cpython-39.pyc b/apps/hotel/__pycache__/views.cpython-39.pyc index 9f13a05..7dfd1a3 100644 --- a/apps/hotel/__pycache__/views.cpython-39.pyc +++ b/apps/hotel/__pycache__/views.cpython-39.pyc Binary files differ diff --git a/apps/hotel/__pycache__/tests.cpython-39.pyc b/apps/hotel/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..d5feaf2 --- /dev/null +++ b/apps/hotel/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/hotel/__pycache__/views.cpython-39.pyc b/apps/hotel/__pycache__/views.cpython-39.pyc index 9f13a05..7dfd1a3 100644 --- a/apps/hotel/__pycache__/views.cpython-39.pyc +++ b/apps/hotel/__pycache__/views.cpython-39.pyc Binary files differ diff --git a/apps/hotel/tests.py b/apps/hotel/tests.py index 7ce503c..345eaee 100644 --- a/apps/hotel/tests.py +++ b/apps/hotel/tests.py @@ -1,3 +1,79 @@ +from apps.hotel.models import Hotel from django.test import TestCase # Create your tests here. +from django.urls import reverse + + +class HotelTest(TestCase): + + @classmethod + def setUpTestData(cls): + Hotel.objects.create(name='Colombia', code='45hv-c') + + # number_of_hoteles = 13 + # for hotel_num in range(number_of_hoteles): + # Hotel.objects.create(name='Brisas %s' % hotel_num, ) + + # def setUp(self): + # pass + # + # def tearDown(self): + # pass + + def test_name_label(self): + hotel = Hotel.objects.get(id=1) + field_label = hotel._meta.get_field('name').verbose_name + self.assertEqual(field_label, 'name') + + def test_code_label(self): + hotel = Hotel.objects.get(id=1) + field_label = hotel._meta.get_field('code').verbose_name + self.assertEqual(field_label, 'code') + + def test_name_max_length(self): + hotel = Hotel.objects.get(id=1) + max_length = hotel._meta.get_field('name').max_length + self.assertEqual(max_length, 60) + + def test_code_max_length(self): + hotel = Hotel.objects.get(id=1) + max_length = hotel._meta.get_field('code').max_length + self.assertEqual(max_length, 60) + + # def test_view_url_accessible_by_name(self): + # resp = self.client.get(reverse('hotel')) + # self.assertEqual(resp.status_code, 200) + # + # def test_view_uses_correct_template(self): + # resp = self.client.get(reverse('hotel')) + # self.assertEqual(resp.status_code, 200) + # + # self.assertTemplateUsed(resp, 'hotel/hotel_list.html') + # + # def test_lists_all_authors(self): + # # Get second page and confirm it has (exactly) remaining 3 items + # resp = self.client.get(reverse('hotel') + '?page=2') + # self.assertEqual(resp.status_code, 200) + # self.assertTrue('is_paginated' in resp.context) + # self.assertTrue(resp.context['is_paginated'] == True) + # self.assertTrue(len(resp.context['hotel_list']) == 3) + + +class ViewsUrlsTest(TestCase): + + def test_view_url_exists_at_desired_location_of_hotel(self): + resp = self.client.get('/hotel/hotel/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_typeRoom(self): + resp = self.client.get('/hotel/type_room/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_room(self): + resp = self.client.get('/hotel/room/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_availableroom(self): + resp = self.client.get('/hotel/availableroom/') + self.assertEqual(resp.status_code, 200) diff --git a/apps/hotel/__pycache__/tests.cpython-39.pyc b/apps/hotel/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..d5feaf2 --- /dev/null +++ b/apps/hotel/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/hotel/__pycache__/views.cpython-39.pyc b/apps/hotel/__pycache__/views.cpython-39.pyc index 9f13a05..7dfd1a3 100644 --- a/apps/hotel/__pycache__/views.cpython-39.pyc +++ b/apps/hotel/__pycache__/views.cpython-39.pyc Binary files differ diff --git a/apps/hotel/tests.py b/apps/hotel/tests.py index 7ce503c..345eaee 100644 --- a/apps/hotel/tests.py +++ b/apps/hotel/tests.py @@ -1,3 +1,79 @@ +from apps.hotel.models import Hotel from django.test import TestCase # Create your tests here. +from django.urls import reverse + + +class HotelTest(TestCase): + + @classmethod + def setUpTestData(cls): + Hotel.objects.create(name='Colombia', code='45hv-c') + + # number_of_hoteles = 13 + # for hotel_num in range(number_of_hoteles): + # Hotel.objects.create(name='Brisas %s' % hotel_num, ) + + # def setUp(self): + # pass + # + # def tearDown(self): + # pass + + def test_name_label(self): + hotel = Hotel.objects.get(id=1) + field_label = hotel._meta.get_field('name').verbose_name + self.assertEqual(field_label, 'name') + + def test_code_label(self): + hotel = Hotel.objects.get(id=1) + field_label = hotel._meta.get_field('code').verbose_name + self.assertEqual(field_label, 'code') + + def test_name_max_length(self): + hotel = Hotel.objects.get(id=1) + max_length = hotel._meta.get_field('name').max_length + self.assertEqual(max_length, 60) + + def test_code_max_length(self): + hotel = Hotel.objects.get(id=1) + max_length = hotel._meta.get_field('code').max_length + self.assertEqual(max_length, 60) + + # def test_view_url_accessible_by_name(self): + # resp = self.client.get(reverse('hotel')) + # self.assertEqual(resp.status_code, 200) + # + # def test_view_uses_correct_template(self): + # resp = self.client.get(reverse('hotel')) + # self.assertEqual(resp.status_code, 200) + # + # self.assertTemplateUsed(resp, 'hotel/hotel_list.html') + # + # def test_lists_all_authors(self): + # # Get second page and confirm it has (exactly) remaining 3 items + # resp = self.client.get(reverse('hotel') + '?page=2') + # self.assertEqual(resp.status_code, 200) + # self.assertTrue('is_paginated' in resp.context) + # self.assertTrue(resp.context['is_paginated'] == True) + # self.assertTrue(len(resp.context['hotel_list']) == 3) + + +class ViewsUrlsTest(TestCase): + + def test_view_url_exists_at_desired_location_of_hotel(self): + resp = self.client.get('/hotel/hotel/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_typeRoom(self): + resp = self.client.get('/hotel/type_room/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_room(self): + resp = self.client.get('/hotel/room/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_availableroom(self): + resp = self.client.get('/hotel/availableroom/') + self.assertEqual(resp.status_code, 200) diff --git a/apps/service/__pycache__/tests.cpython-39.pyc b/apps/service/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..da4cbaa --- /dev/null +++ b/apps/service/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/hotel/__pycache__/tests.cpython-39.pyc b/apps/hotel/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..d5feaf2 --- /dev/null +++ b/apps/hotel/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/hotel/__pycache__/views.cpython-39.pyc b/apps/hotel/__pycache__/views.cpython-39.pyc index 9f13a05..7dfd1a3 100644 --- a/apps/hotel/__pycache__/views.cpython-39.pyc +++ b/apps/hotel/__pycache__/views.cpython-39.pyc Binary files differ diff --git a/apps/hotel/tests.py b/apps/hotel/tests.py index 7ce503c..345eaee 100644 --- a/apps/hotel/tests.py +++ b/apps/hotel/tests.py @@ -1,3 +1,79 @@ +from apps.hotel.models import Hotel from django.test import TestCase # Create your tests here. +from django.urls import reverse + + +class HotelTest(TestCase): + + @classmethod + def setUpTestData(cls): + Hotel.objects.create(name='Colombia', code='45hv-c') + + # number_of_hoteles = 13 + # for hotel_num in range(number_of_hoteles): + # Hotel.objects.create(name='Brisas %s' % hotel_num, ) + + # def setUp(self): + # pass + # + # def tearDown(self): + # pass + + def test_name_label(self): + hotel = Hotel.objects.get(id=1) + field_label = hotel._meta.get_field('name').verbose_name + self.assertEqual(field_label, 'name') + + def test_code_label(self): + hotel = Hotel.objects.get(id=1) + field_label = hotel._meta.get_field('code').verbose_name + self.assertEqual(field_label, 'code') + + def test_name_max_length(self): + hotel = Hotel.objects.get(id=1) + max_length = hotel._meta.get_field('name').max_length + self.assertEqual(max_length, 60) + + def test_code_max_length(self): + hotel = Hotel.objects.get(id=1) + max_length = hotel._meta.get_field('code').max_length + self.assertEqual(max_length, 60) + + # def test_view_url_accessible_by_name(self): + # resp = self.client.get(reverse('hotel')) + # self.assertEqual(resp.status_code, 200) + # + # def test_view_uses_correct_template(self): + # resp = self.client.get(reverse('hotel')) + # self.assertEqual(resp.status_code, 200) + # + # self.assertTemplateUsed(resp, 'hotel/hotel_list.html') + # + # def test_lists_all_authors(self): + # # Get second page and confirm it has (exactly) remaining 3 items + # resp = self.client.get(reverse('hotel') + '?page=2') + # self.assertEqual(resp.status_code, 200) + # self.assertTrue('is_paginated' in resp.context) + # self.assertTrue(resp.context['is_paginated'] == True) + # self.assertTrue(len(resp.context['hotel_list']) == 3) + + +class ViewsUrlsTest(TestCase): + + def test_view_url_exists_at_desired_location_of_hotel(self): + resp = self.client.get('/hotel/hotel/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_typeRoom(self): + resp = self.client.get('/hotel/type_room/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_room(self): + resp = self.client.get('/hotel/room/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_availableroom(self): + resp = self.client.get('/hotel/availableroom/') + self.assertEqual(resp.status_code, 200) diff --git a/apps/service/__pycache__/tests.cpython-39.pyc b/apps/service/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..da4cbaa --- /dev/null +++ b/apps/service/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/service/tests.py b/apps/service/tests.py index 7ce503c..47d1e9f 100644 --- a/apps/service/tests.py +++ b/apps/service/tests.py @@ -1,3 +1,92 @@ +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) diff --git a/apps/hotel/__pycache__/tests.cpython-39.pyc b/apps/hotel/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..d5feaf2 --- /dev/null +++ b/apps/hotel/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/hotel/__pycache__/views.cpython-39.pyc b/apps/hotel/__pycache__/views.cpython-39.pyc index 9f13a05..7dfd1a3 100644 --- a/apps/hotel/__pycache__/views.cpython-39.pyc +++ b/apps/hotel/__pycache__/views.cpython-39.pyc Binary files differ diff --git a/apps/hotel/tests.py b/apps/hotel/tests.py index 7ce503c..345eaee 100644 --- a/apps/hotel/tests.py +++ b/apps/hotel/tests.py @@ -1,3 +1,79 @@ +from apps.hotel.models import Hotel from django.test import TestCase # Create your tests here. +from django.urls import reverse + + +class HotelTest(TestCase): + + @classmethod + def setUpTestData(cls): + Hotel.objects.create(name='Colombia', code='45hv-c') + + # number_of_hoteles = 13 + # for hotel_num in range(number_of_hoteles): + # Hotel.objects.create(name='Brisas %s' % hotel_num, ) + + # def setUp(self): + # pass + # + # def tearDown(self): + # pass + + def test_name_label(self): + hotel = Hotel.objects.get(id=1) + field_label = hotel._meta.get_field('name').verbose_name + self.assertEqual(field_label, 'name') + + def test_code_label(self): + hotel = Hotel.objects.get(id=1) + field_label = hotel._meta.get_field('code').verbose_name + self.assertEqual(field_label, 'code') + + def test_name_max_length(self): + hotel = Hotel.objects.get(id=1) + max_length = hotel._meta.get_field('name').max_length + self.assertEqual(max_length, 60) + + def test_code_max_length(self): + hotel = Hotel.objects.get(id=1) + max_length = hotel._meta.get_field('code').max_length + self.assertEqual(max_length, 60) + + # def test_view_url_accessible_by_name(self): + # resp = self.client.get(reverse('hotel')) + # self.assertEqual(resp.status_code, 200) + # + # def test_view_uses_correct_template(self): + # resp = self.client.get(reverse('hotel')) + # self.assertEqual(resp.status_code, 200) + # + # self.assertTemplateUsed(resp, 'hotel/hotel_list.html') + # + # def test_lists_all_authors(self): + # # Get second page and confirm it has (exactly) remaining 3 items + # resp = self.client.get(reverse('hotel') + '?page=2') + # self.assertEqual(resp.status_code, 200) + # self.assertTrue('is_paginated' in resp.context) + # self.assertTrue(resp.context['is_paginated'] == True) + # self.assertTrue(len(resp.context['hotel_list']) == 3) + + +class ViewsUrlsTest(TestCase): + + def test_view_url_exists_at_desired_location_of_hotel(self): + resp = self.client.get('/hotel/hotel/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_typeRoom(self): + resp = self.client.get('/hotel/type_room/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_room(self): + resp = self.client.get('/hotel/room/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_availableroom(self): + resp = self.client.get('/hotel/availableroom/') + self.assertEqual(resp.status_code, 200) diff --git a/apps/service/__pycache__/tests.cpython-39.pyc b/apps/service/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..da4cbaa --- /dev/null +++ b/apps/service/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/service/tests.py b/apps/service/tests.py index 7ce503c..47d1e9f 100644 --- a/apps/service/tests.py +++ b/apps/service/tests.py @@ -1,3 +1,92 @@ +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) diff --git a/apps/user/__pycache__/models.cpython-39.pyc b/apps/user/__pycache__/models.cpython-39.pyc index 1a1e477..a284718 100644 --- a/apps/user/__pycache__/models.cpython-39.pyc +++ b/apps/user/__pycache__/models.cpython-39.pyc Binary files differ diff --git a/apps/hotel/__pycache__/tests.cpython-39.pyc b/apps/hotel/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..d5feaf2 --- /dev/null +++ b/apps/hotel/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/hotel/__pycache__/views.cpython-39.pyc b/apps/hotel/__pycache__/views.cpython-39.pyc index 9f13a05..7dfd1a3 100644 --- a/apps/hotel/__pycache__/views.cpython-39.pyc +++ b/apps/hotel/__pycache__/views.cpython-39.pyc Binary files differ diff --git a/apps/hotel/tests.py b/apps/hotel/tests.py index 7ce503c..345eaee 100644 --- a/apps/hotel/tests.py +++ b/apps/hotel/tests.py @@ -1,3 +1,79 @@ +from apps.hotel.models import Hotel from django.test import TestCase # Create your tests here. +from django.urls import reverse + + +class HotelTest(TestCase): + + @classmethod + def setUpTestData(cls): + Hotel.objects.create(name='Colombia', code='45hv-c') + + # number_of_hoteles = 13 + # for hotel_num in range(number_of_hoteles): + # Hotel.objects.create(name='Brisas %s' % hotel_num, ) + + # def setUp(self): + # pass + # + # def tearDown(self): + # pass + + def test_name_label(self): + hotel = Hotel.objects.get(id=1) + field_label = hotel._meta.get_field('name').verbose_name + self.assertEqual(field_label, 'name') + + def test_code_label(self): + hotel = Hotel.objects.get(id=1) + field_label = hotel._meta.get_field('code').verbose_name + self.assertEqual(field_label, 'code') + + def test_name_max_length(self): + hotel = Hotel.objects.get(id=1) + max_length = hotel._meta.get_field('name').max_length + self.assertEqual(max_length, 60) + + def test_code_max_length(self): + hotel = Hotel.objects.get(id=1) + max_length = hotel._meta.get_field('code').max_length + self.assertEqual(max_length, 60) + + # def test_view_url_accessible_by_name(self): + # resp = self.client.get(reverse('hotel')) + # self.assertEqual(resp.status_code, 200) + # + # def test_view_uses_correct_template(self): + # resp = self.client.get(reverse('hotel')) + # self.assertEqual(resp.status_code, 200) + # + # self.assertTemplateUsed(resp, 'hotel/hotel_list.html') + # + # def test_lists_all_authors(self): + # # Get second page and confirm it has (exactly) remaining 3 items + # resp = self.client.get(reverse('hotel') + '?page=2') + # self.assertEqual(resp.status_code, 200) + # self.assertTrue('is_paginated' in resp.context) + # self.assertTrue(resp.context['is_paginated'] == True) + # self.assertTrue(len(resp.context['hotel_list']) == 3) + + +class ViewsUrlsTest(TestCase): + + def test_view_url_exists_at_desired_location_of_hotel(self): + resp = self.client.get('/hotel/hotel/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_typeRoom(self): + resp = self.client.get('/hotel/type_room/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_room(self): + resp = self.client.get('/hotel/room/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_availableroom(self): + resp = self.client.get('/hotel/availableroom/') + self.assertEqual(resp.status_code, 200) diff --git a/apps/service/__pycache__/tests.cpython-39.pyc b/apps/service/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..da4cbaa --- /dev/null +++ b/apps/service/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/service/tests.py b/apps/service/tests.py index 7ce503c..47d1e9f 100644 --- a/apps/service/tests.py +++ b/apps/service/tests.py @@ -1,3 +1,92 @@ +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) diff --git a/apps/user/__pycache__/models.cpython-39.pyc b/apps/user/__pycache__/models.cpython-39.pyc index 1a1e477..a284718 100644 --- a/apps/user/__pycache__/models.cpython-39.pyc +++ b/apps/user/__pycache__/models.cpython-39.pyc Binary files differ diff --git a/apps/user/__pycache__/tests.cpython-39.pyc b/apps/user/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..b6684f3 --- /dev/null +++ b/apps/user/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/hotel/__pycache__/tests.cpython-39.pyc b/apps/hotel/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..d5feaf2 --- /dev/null +++ b/apps/hotel/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/hotel/__pycache__/views.cpython-39.pyc b/apps/hotel/__pycache__/views.cpython-39.pyc index 9f13a05..7dfd1a3 100644 --- a/apps/hotel/__pycache__/views.cpython-39.pyc +++ b/apps/hotel/__pycache__/views.cpython-39.pyc Binary files differ diff --git a/apps/hotel/tests.py b/apps/hotel/tests.py index 7ce503c..345eaee 100644 --- a/apps/hotel/tests.py +++ b/apps/hotel/tests.py @@ -1,3 +1,79 @@ +from apps.hotel.models import Hotel from django.test import TestCase # Create your tests here. +from django.urls import reverse + + +class HotelTest(TestCase): + + @classmethod + def setUpTestData(cls): + Hotel.objects.create(name='Colombia', code='45hv-c') + + # number_of_hoteles = 13 + # for hotel_num in range(number_of_hoteles): + # Hotel.objects.create(name='Brisas %s' % hotel_num, ) + + # def setUp(self): + # pass + # + # def tearDown(self): + # pass + + def test_name_label(self): + hotel = Hotel.objects.get(id=1) + field_label = hotel._meta.get_field('name').verbose_name + self.assertEqual(field_label, 'name') + + def test_code_label(self): + hotel = Hotel.objects.get(id=1) + field_label = hotel._meta.get_field('code').verbose_name + self.assertEqual(field_label, 'code') + + def test_name_max_length(self): + hotel = Hotel.objects.get(id=1) + max_length = hotel._meta.get_field('name').max_length + self.assertEqual(max_length, 60) + + def test_code_max_length(self): + hotel = Hotel.objects.get(id=1) + max_length = hotel._meta.get_field('code').max_length + self.assertEqual(max_length, 60) + + # def test_view_url_accessible_by_name(self): + # resp = self.client.get(reverse('hotel')) + # self.assertEqual(resp.status_code, 200) + # + # def test_view_uses_correct_template(self): + # resp = self.client.get(reverse('hotel')) + # self.assertEqual(resp.status_code, 200) + # + # self.assertTemplateUsed(resp, 'hotel/hotel_list.html') + # + # def test_lists_all_authors(self): + # # Get second page and confirm it has (exactly) remaining 3 items + # resp = self.client.get(reverse('hotel') + '?page=2') + # self.assertEqual(resp.status_code, 200) + # self.assertTrue('is_paginated' in resp.context) + # self.assertTrue(resp.context['is_paginated'] == True) + # self.assertTrue(len(resp.context['hotel_list']) == 3) + + +class ViewsUrlsTest(TestCase): + + def test_view_url_exists_at_desired_location_of_hotel(self): + resp = self.client.get('/hotel/hotel/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_typeRoom(self): + resp = self.client.get('/hotel/type_room/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_room(self): + resp = self.client.get('/hotel/room/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_availableroom(self): + resp = self.client.get('/hotel/availableroom/') + self.assertEqual(resp.status_code, 200) diff --git a/apps/service/__pycache__/tests.cpython-39.pyc b/apps/service/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..da4cbaa --- /dev/null +++ b/apps/service/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/service/tests.py b/apps/service/tests.py index 7ce503c..47d1e9f 100644 --- a/apps/service/tests.py +++ b/apps/service/tests.py @@ -1,3 +1,92 @@ +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) diff --git a/apps/user/__pycache__/models.cpython-39.pyc b/apps/user/__pycache__/models.cpython-39.pyc index 1a1e477..a284718 100644 --- a/apps/user/__pycache__/models.cpython-39.pyc +++ b/apps/user/__pycache__/models.cpython-39.pyc Binary files differ diff --git a/apps/user/__pycache__/tests.cpython-39.pyc b/apps/user/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..b6684f3 --- /dev/null +++ b/apps/user/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/user/__pycache__/urls.cpython-39.pyc b/apps/user/__pycache__/urls.cpython-39.pyc index 98aaa05..0dab706 100644 --- a/apps/user/__pycache__/urls.cpython-39.pyc +++ b/apps/user/__pycache__/urls.cpython-39.pyc Binary files differ diff --git a/apps/hotel/__pycache__/tests.cpython-39.pyc b/apps/hotel/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..d5feaf2 --- /dev/null +++ b/apps/hotel/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/hotel/__pycache__/views.cpython-39.pyc b/apps/hotel/__pycache__/views.cpython-39.pyc index 9f13a05..7dfd1a3 100644 --- a/apps/hotel/__pycache__/views.cpython-39.pyc +++ b/apps/hotel/__pycache__/views.cpython-39.pyc Binary files differ diff --git a/apps/hotel/tests.py b/apps/hotel/tests.py index 7ce503c..345eaee 100644 --- a/apps/hotel/tests.py +++ b/apps/hotel/tests.py @@ -1,3 +1,79 @@ +from apps.hotel.models import Hotel from django.test import TestCase # Create your tests here. +from django.urls import reverse + + +class HotelTest(TestCase): + + @classmethod + def setUpTestData(cls): + Hotel.objects.create(name='Colombia', code='45hv-c') + + # number_of_hoteles = 13 + # for hotel_num in range(number_of_hoteles): + # Hotel.objects.create(name='Brisas %s' % hotel_num, ) + + # def setUp(self): + # pass + # + # def tearDown(self): + # pass + + def test_name_label(self): + hotel = Hotel.objects.get(id=1) + field_label = hotel._meta.get_field('name').verbose_name + self.assertEqual(field_label, 'name') + + def test_code_label(self): + hotel = Hotel.objects.get(id=1) + field_label = hotel._meta.get_field('code').verbose_name + self.assertEqual(field_label, 'code') + + def test_name_max_length(self): + hotel = Hotel.objects.get(id=1) + max_length = hotel._meta.get_field('name').max_length + self.assertEqual(max_length, 60) + + def test_code_max_length(self): + hotel = Hotel.objects.get(id=1) + max_length = hotel._meta.get_field('code').max_length + self.assertEqual(max_length, 60) + + # def test_view_url_accessible_by_name(self): + # resp = self.client.get(reverse('hotel')) + # self.assertEqual(resp.status_code, 200) + # + # def test_view_uses_correct_template(self): + # resp = self.client.get(reverse('hotel')) + # self.assertEqual(resp.status_code, 200) + # + # self.assertTemplateUsed(resp, 'hotel/hotel_list.html') + # + # def test_lists_all_authors(self): + # # Get second page and confirm it has (exactly) remaining 3 items + # resp = self.client.get(reverse('hotel') + '?page=2') + # self.assertEqual(resp.status_code, 200) + # self.assertTrue('is_paginated' in resp.context) + # self.assertTrue(resp.context['is_paginated'] == True) + # self.assertTrue(len(resp.context['hotel_list']) == 3) + + +class ViewsUrlsTest(TestCase): + + def test_view_url_exists_at_desired_location_of_hotel(self): + resp = self.client.get('/hotel/hotel/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_typeRoom(self): + resp = self.client.get('/hotel/type_room/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_room(self): + resp = self.client.get('/hotel/room/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_availableroom(self): + resp = self.client.get('/hotel/availableroom/') + self.assertEqual(resp.status_code, 200) diff --git a/apps/service/__pycache__/tests.cpython-39.pyc b/apps/service/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..da4cbaa --- /dev/null +++ b/apps/service/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/service/tests.py b/apps/service/tests.py index 7ce503c..47d1e9f 100644 --- a/apps/service/tests.py +++ b/apps/service/tests.py @@ -1,3 +1,92 @@ +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) diff --git a/apps/user/__pycache__/models.cpython-39.pyc b/apps/user/__pycache__/models.cpython-39.pyc index 1a1e477..a284718 100644 --- a/apps/user/__pycache__/models.cpython-39.pyc +++ b/apps/user/__pycache__/models.cpython-39.pyc Binary files differ diff --git a/apps/user/__pycache__/tests.cpython-39.pyc b/apps/user/__pycache__/tests.cpython-39.pyc new file mode 100644 index 0000000..b6684f3 --- /dev/null +++ b/apps/user/__pycache__/tests.cpython-39.pyc Binary files differ diff --git a/apps/user/__pycache__/urls.cpython-39.pyc b/apps/user/__pycache__/urls.cpython-39.pyc index 98aaa05..0dab706 100644 --- a/apps/user/__pycache__/urls.cpython-39.pyc +++ b/apps/user/__pycache__/urls.cpython-39.pyc Binary files differ diff --git a/apps/user/tests.py b/apps/user/tests.py index 7ce503c..bca88fc 100644 --- a/apps/user/tests.py +++ b/apps/user/tests.py @@ -1,3 +1,49 @@ +from apps.user.models import Gender +from apps.user.views import GenderViewSet from django.test import TestCase # Create your tests here. +from django.urls import reverse +from rest_framework import status +from rest_framework.test import APIClient + + +class UserTest(TestCase): + + def setUp(self): + self.client = APIClient() + + self.nodo_gender = Gender.objects.create(name='Masculino', acronym='M') + + # def test_can_update_gender(self): + # url = reverse(GenderViewSet.name, kwargs={'pk': self.nodo_gender.id}) + # + # data = {'name': 'Femenina'} + # resp = self.client.put(url, data, format='json') + # output = resp.data + # self.assertEqual(resp.status_code, status.HTTP_200_OK) + # self.assertEqual(output['id'], self.nodo_gender.id) + # self.assertEqual(output['name'], 'Femenina') + + +class ViewsUrlsTest(TestCase): + + def test_view_url_exists_at_desired_location_of_gender(self): + resp = self.client.get('/user/gender/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_user(self): + resp = self.client.get('/user/user/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_group(self): + resp = self.client.get('/user/group/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_region(self): + resp = self.client.get('/user/region/') + self.assertEqual(resp.status_code, 200) + + def test_view_url_exists_at_desired_location_of_regiongovern(self): + resp = self.client.get('/user/regiongovern/') + self.assertEqual(resp.status_code, 200)