[ADD] test cases for room types

This commit is contained in:
Pablo
2019-09-13 17:48:10 +02:00
parent 3a207d3a24
commit 126500c619
3 changed files with 25 additions and 3 deletions

View File

@@ -22,6 +22,6 @@
##############################################################################
# from . import test_reservation
# from . import test_folio
# from . import test_hotel_room_type_model
# from . import test_hotel_room_model
from . import test_inherited_ir_http
from . import test_hotel_room_type

View File

@@ -79,11 +79,17 @@ class TestHotel(common.SavepointCase):
cls._init_mock_hotel()
# Create Tests Records
cls.main_hotel_property = cls.env.ref('hotel.main_hotel_property')
cls.demo_hotel_property = cls.env.ref('hotel.demo_hotel_property')
cls.room_type_0 = cls.env.ref('hotel.hotel_room_type_0')
cls.room_type_1 = cls.env.ref('hotel.hotel_room_type_1')
cls.room_type_2 = cls.env.ref('hotel.hotel_room_type_2')
cls.room_type_3 = cls.env.ref('hotel.hotel_room_type_3')
cls.demo_room_type_0 = cls.env.ref('hotel.demo_hotel_room_type_0')
cls.demo_room_type_1 = cls.env.ref('hotel.demo_hotel_room_type_1')
cls.room_0 = cls.env.ref('hotel.hotel_room_0')
cls.room_1 = cls.env.ref('hotel.hotel_room_1')
cls.room_2 = cls.env.ref('hotel.hotel_room_2')
@@ -91,3 +97,4 @@ class TestHotel(common.SavepointCase):
cls.room_4 = cls.env.ref('hotel.hotel_room_4')
cls.room_5 = cls.env.ref('hotel.hotel_room_5')
cls.room_6 = cls.env.ref('hotel.hotel_room_6')

View File

@@ -27,9 +27,24 @@ from odoo.tools import mute_logger
class TestHotelRoomType(TestHotel):
def test_code_type_unique(self):
#TODO: use sudo users hotel
# TODO: use users with different access rules
# code type must be unique by hotel
def test_code_type_unique_by_hotel(self):
with self.assertRaises(IntegrityError), mute_logger('odoo.sql_db'):
self.room_type_0.sudo().write({
'code_type': self.room_type_1.code_type
})
# code type can be used in other hotel
def test_code_type_unique_shared_by_hotel(self):
test_result = self.demo_room_type_0.sudo().write({
'code_type': self.room_type_0.code_type
})
self.assertEqual(test_result, True)
# rooms of the same room type are in the same hotel
def test_coherence_rooms_by_hotel(self):
# TODO: ...
pass