[WIP] Test cases

This commit is contained in:
Dario Lodeiros
2018-11-08 13:50:46 +01:00
parent a9116f3b13
commit c1ac80d846
3 changed files with 16 additions and 35 deletions

View File

@@ -13,31 +13,31 @@
<!-- hotel_room_amenities_type -->
<record id="hotel_amenitiy_type_0" model="hotel.room.amenities.type">
<record id="hotel_amenitiy_type_0" model="hotel.amenity.type">
<field name="name">Beds</field>
</record>
<record id="hotel_amenity_type_1" model="hotel.room.amenities.type">
<record id="hotel_amenity_type_1" model="hotel.amenity.type">
<field name="name">Connectivity</field>
</record>
<record id="hotel_amenity_type_2" model="hotel.room.amenities.type">
<record id="hotel_amenity_type_2" model="hotel.amenity.type">
<field name="name">Extra</field>
</record>
<!-- hotel_room_amenitues -->
<record id="hotel_amenity_0" model="hotel.room.amenities">
<record id="hotel_amenity_0" model="hotel.amenity">
<field name="name">Twin Beds</field>
<field name="room_amenity_type_id" search="[('name', '=', 'Beds')]"/>
</record>
<record id="hotel_amenity_1" model="hotel.room.amenities">
<record id="hotel_amenity_1" model="hotel.amenity">
<field name="name">Double Beds</field>
<field name="room_amenity_type_id" search="[('name', '=', 'Beds')]"/>
</record>
<record id="hotel_amenity_2" model="hotel.room.amenities">
<record id="hotel_amenity_2" model="hotel.amenity">
<field name="name">Extra Bed</field>
<field name="room_amenity_type_id" search="[('name', '=', 'Beds')]"/>
</record>
<record id="hotel_amenity_3" model="hotel.room.amenities">
<record id="hotel_amenity_3" model="hotel.amenity">
<field name="name">4G</field>
<field name="room_amenity_type_id" search="[('name', '=', 'Connectivity')]"/>
</record>

View File

@@ -22,3 +22,4 @@
##############################################################################
#from . import test_reservation
#from . import test_folio
from . import test_hotel_room_type_model

View File

@@ -20,36 +20,16 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from datetime import timedelta
from .common import TestHotel
from odoo.addons.hotel import date_utils
from odoo.exceptions import ValidationError
class TestHotelRoomType(TestHotel):
def test_cancel_folio(self):
now_utc_dt = date_utils.now()
def test_change_room_ids(self):
org_reserv_start_utc_dt = now_utc_dt + timedelta(days=3)
org_reserv_end_utc_dt = org_reserv_start_utc_dt + timedelta(days=6)
folio = self.create_folio(self.user_hotel_manager, self.partner_2)
reservation_a = self.create_reservation(
self.user_hotel_manager,
folio,
org_reserv_start_utc_dt,
org_reserv_end_utc_dt,
self.hotel_room_double_200,
"Reservation Test #1")
reservation_b = self.create_reservation(
self.user_hotel_manager,
folio,
org_reserv_start_utc_dt,
org_reserv_end_utc_dt,
self.hotel_room_simple_100,
"Reservation Test #2")
self.assertEqual(len(folio.room_lines), 2, 'Invalid room lines count')
folio.action_cancel()
self.assertEqual(folio.state, 'cancel', 'Invalid folio state')
for rline in folio.room_lines:
self.assertEqual(rline.state, 'cancelled',
'Invalid reservation state')
# Avoid the unconscious change of room type_id from room_type
#TODO: use sudo users hotel
with self.assertRaises(ValidationError):
cls.room_type_0.sudo().write({
'room_ids':(4, cls.room_type_3.id)
})