mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[REF] pms: refactor board service room type tests
This commit is contained in:
@@ -4,9 +4,6 @@ from .common import TestPms
|
||||
|
||||
|
||||
class TestPmsBoardService(TestPms):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
def test_pms_board_service_line_product_property_integrity(self):
|
||||
"""
|
||||
Creation of a board service line without property, of a product
|
||||
|
||||
@@ -1,81 +1,89 @@
|
||||
from odoo.tests import common
|
||||
from .common import TestPms
|
||||
|
||||
|
||||
class TestPmsBoardServiceRoomType(common.SavepointCase):
|
||||
def _create_common_scenario(self):
|
||||
self.company1 = self.env["res.company"].create(
|
||||
{
|
||||
"name": "Pms_Company_Test",
|
||||
}
|
||||
)
|
||||
self.folio_sequence = self.env["ir.sequence"].create(
|
||||
{
|
||||
"name": "PMS Folio",
|
||||
"code": "pms.folio",
|
||||
"padding": 4,
|
||||
"company_id": self.company1.id,
|
||||
}
|
||||
)
|
||||
self.reservation_sequence = self.env["ir.sequence"].create(
|
||||
{
|
||||
"name": "PMS Reservation",
|
||||
"code": "pms.reservation",
|
||||
"padding": 4,
|
||||
"company_id": self.company1.id,
|
||||
}
|
||||
)
|
||||
self.checkin_sequence = self.env["ir.sequence"].create(
|
||||
{
|
||||
"name": "PMS Checkin",
|
||||
"code": "pms.checkin.partner",
|
||||
"padding": 4,
|
||||
"company_id": self.company1.id,
|
||||
}
|
||||
)
|
||||
self.property1 = self.env["pms.property"].create(
|
||||
{
|
||||
"name": "Pms_property_test1",
|
||||
"company_id": self.company1.id,
|
||||
"default_pricelist_id": self.env.ref("product.list0").id,
|
||||
"folio_sequence_id": self.folio_sequence.id,
|
||||
"reservation_sequence_id": self.reservation_sequence.id,
|
||||
"checkin_sequence_id": self.checkin_sequence.id,
|
||||
}
|
||||
)
|
||||
self.property2 = self.env["pms.property"].create(
|
||||
{
|
||||
"name": "Pms_property_test2",
|
||||
"company_id": self.company1.id,
|
||||
"default_pricelist_id": self.env.ref("product.list0").id,
|
||||
"folio_sequence_id": self.folio_sequence.id,
|
||||
"reservation_sequence_id": self.reservation_sequence.id,
|
||||
"checkin_sequence_id": self.checkin_sequence.id,
|
||||
}
|
||||
)
|
||||
self.room_type_availability = self.env["pms.availability.plan"].create(
|
||||
{"name": "Availability plan for TEST"}
|
||||
)
|
||||
class TestPmsBoardServiceRoomType(TestPms):
|
||||
|
||||
# create room type class
|
||||
self.room_type_class = self.env["pms.room.type.class"].create(
|
||||
{"name": "Room", "default_code": "ROOM"}
|
||||
)
|
||||
# def _create_common_scenario(self):
|
||||
# self.company1 = self.env["res.company"].create(
|
||||
# {
|
||||
# "name": "Pms_Company_Test",
|
||||
# }
|
||||
# )
|
||||
# self.folio_sequence = self.env["ir.sequence"].create(
|
||||
# {
|
||||
# "name": "PMS Folio",
|
||||
# "code": "pms.folio",
|
||||
# "padding": 4,
|
||||
# "company_id": self.company1.id,
|
||||
# }
|
||||
# )
|
||||
# self.reservation_sequence = self.env["ir.sequence"].create(
|
||||
# {
|
||||
# "name": "PMS Reservation",
|
||||
# "code": "pms.reservation",
|
||||
# "padding": 4,
|
||||
# "company_id": self.company1.id,
|
||||
# }
|
||||
# )
|
||||
# self.checkin_sequence = self.env["ir.sequence"].create(
|
||||
# {
|
||||
# "name": "PMS Checkin",
|
||||
# "code": "pms.checkin.partner",
|
||||
# "padding": 4,
|
||||
# "company_id": self.company1.id,
|
||||
# }
|
||||
# )
|
||||
# self.property1 = self.env["pms.property"].create(
|
||||
# {
|
||||
# "name": "Pms_property_test1",
|
||||
# "company_id": self.company1.id,
|
||||
# "default_pricelist_id": self.env.ref("product.list0").id,
|
||||
# "folio_sequence_id": self.folio_sequence.id,
|
||||
# "reservation_sequence_id": self.reservation_sequence.id,
|
||||
# "checkin_sequence_id": self.checkin_sequence.id,
|
||||
# }
|
||||
# )
|
||||
# self.property2 = self.env["pms.property"].create(
|
||||
# {
|
||||
# "name": "Pms_property_test2",
|
||||
# "company_id": self.company1.id,
|
||||
# "default_pricelist_id": self.env.ref("product.list0").id,
|
||||
# "folio_sequence_id": self.folio_sequence.id,
|
||||
# "reservation_sequence_id": self.reservation_sequence.id,
|
||||
# "checkin_sequence_id": self.checkin_sequence.id,
|
||||
# }
|
||||
# )
|
||||
# self.room_type_availability = self.env["pms.availability.plan"].create(
|
||||
# {"name": "Availability plan for TEST"}
|
||||
# )
|
||||
#
|
||||
# # create room type class
|
||||
# self.room_type_class = self.env["pms.room.type.class"].create(
|
||||
# {"name": "Room", "default_code": "ROOM"}
|
||||
# )
|
||||
|
||||
def test_create_rt_props_gt_bs_props(self):
|
||||
# TEST CASE
|
||||
# Create board service for a room type and the room type
|
||||
# have MORE properties than the board service.
|
||||
# Record of board_service_room_type should contain the
|
||||
# board service properties.
|
||||
|
||||
"""
|
||||
Create board service for a room type and the room type
|
||||
have MORE properties than the board service.
|
||||
Record of board_service_room_type should contain the
|
||||
board service properties.
|
||||
"""
|
||||
# ARRANGE
|
||||
self._create_common_scenario()
|
||||
pms_property2 = self.env["pms.property"].create(
|
||||
{
|
||||
"name": "Property 2",
|
||||
"company_id": self.company1.id,
|
||||
"default_pricelist_id": self.pricelist1.id,
|
||||
}
|
||||
)
|
||||
|
||||
room_type_double = self.env["pms.room.type"].create(
|
||||
{
|
||||
"pms_property_ids": [self.property1.id, self.property2.id],
|
||||
"pms_property_ids": [self.pms_property1.id, pms_property2.id],
|
||||
"name": "Double Test",
|
||||
"default_code": "DBL_Test",
|
||||
"class_id": self.room_type_class.id,
|
||||
"class_id": self.room_type_class1.id,
|
||||
"price": 25,
|
||||
}
|
||||
)
|
||||
@@ -83,7 +91,7 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
||||
{
|
||||
"name": "Test Board Service",
|
||||
"default_code": "TPS",
|
||||
"pms_property_ids": [self.property1.id],
|
||||
"pms_property_ids": [self.pms_property1.id],
|
||||
}
|
||||
)
|
||||
# ACT
|
||||
@@ -102,20 +110,26 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
||||
)
|
||||
|
||||
def test_create_rt_props_lt_bs_props(self):
|
||||
# TEST CASE
|
||||
# Create board service for a room type and the room type
|
||||
# have LESS properties than the board service.
|
||||
# Record of board_service_room_type should contain the
|
||||
# room types properties.
|
||||
|
||||
"""
|
||||
Create board service for a room type and the room type
|
||||
have LESS properties than the board service.
|
||||
Record of board_service_room_type should contain the
|
||||
room types properties.
|
||||
"""
|
||||
# ARRANGE
|
||||
self._create_common_scenario()
|
||||
pms_property2 = self.env["pms.property"].create(
|
||||
{
|
||||
"name": "Property 2",
|
||||
"company_id": self.company1.id,
|
||||
"default_pricelist_id": self.pricelist1.id,
|
||||
}
|
||||
)
|
||||
room_type_double = self.env["pms.room.type"].create(
|
||||
{
|
||||
"pms_property_ids": [self.property1.id],
|
||||
"pms_property_ids": [self.pms_property1.id],
|
||||
"name": "Double Test",
|
||||
"default_code": "DBL_Test",
|
||||
"class_id": self.room_type_class.id,
|
||||
"class_id": self.room_type_class1.id,
|
||||
"price": 25,
|
||||
}
|
||||
)
|
||||
@@ -123,7 +137,7 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
||||
{
|
||||
"name": "Test Board Service",
|
||||
"default_code": "TPS",
|
||||
"pms_property_ids": [self.property1.id, self.property2.id],
|
||||
"pms_property_ids": [self.pms_property1.id, pms_property2.id],
|
||||
}
|
||||
)
|
||||
# ACT
|
||||
@@ -142,21 +156,20 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
||||
)
|
||||
|
||||
def test_create_rt_props_eq_bs_props(self):
|
||||
# TEST CASE
|
||||
# Create board service for a room type and the room type
|
||||
# have THE SAME properties than the board service.
|
||||
# Record of board_service_room_type should contain the
|
||||
# room types properties that matchs with the board
|
||||
# service properties
|
||||
|
||||
"""
|
||||
Create board service for a room type and the room type
|
||||
have THE SAME properties than the board service.
|
||||
Record of board_service_room_type should contain the
|
||||
room types properties that matchs with the board
|
||||
service properties
|
||||
"""
|
||||
# ARRANGE
|
||||
self._create_common_scenario()
|
||||
room_type_double = self.env["pms.room.type"].create(
|
||||
{
|
||||
"pms_property_ids": [self.property1.id],
|
||||
"pms_property_ids": [self.pms_property1.id],
|
||||
"name": "Double Test",
|
||||
"default_code": "DBL_Test",
|
||||
"class_id": self.room_type_class.id,
|
||||
"class_id": self.room_type_class1.id,
|
||||
"price": 25,
|
||||
}
|
||||
)
|
||||
@@ -164,7 +177,7 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
||||
{
|
||||
"name": "Test Board Service",
|
||||
"default_code": "TPS",
|
||||
"pms_property_ids": [self.property1.id],
|
||||
"pms_property_ids": [self.pms_property1.id],
|
||||
}
|
||||
)
|
||||
# ACT
|
||||
@@ -184,19 +197,18 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
||||
)
|
||||
|
||||
def test_create_rt_no_props_and_bs_props(self):
|
||||
# TEST CASE
|
||||
# Create board service for a room type and the room type
|
||||
# hasn't properties but the board services.
|
||||
# Record of board_service_room_type should contain the
|
||||
# board service properties.
|
||||
|
||||
"""
|
||||
Create board service for a room type and the room type
|
||||
hasn't properties but the board services.
|
||||
Record of board_service_room_type should contain the
|
||||
board service properties.
|
||||
"""
|
||||
# ARRANGE
|
||||
self._create_common_scenario()
|
||||
room_type_double = self.env["pms.room.type"].create(
|
||||
{
|
||||
"name": "Double Test",
|
||||
"default_code": "DBL_Test",
|
||||
"class_id": self.room_type_class.id,
|
||||
"class_id": self.room_type_class1.id,
|
||||
"price": 25,
|
||||
}
|
||||
)
|
||||
@@ -204,7 +216,7 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
||||
{
|
||||
"name": "Test Board Service",
|
||||
"default_code": "TPS",
|
||||
"pms_property_ids": [self.property1.id],
|
||||
"pms_property_ids": [self.pms_property1.id],
|
||||
}
|
||||
)
|
||||
# ACT
|
||||
@@ -223,20 +235,26 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
||||
)
|
||||
|
||||
def test_create_rt_props_and_bs_no_props(self):
|
||||
# TEST CASE
|
||||
# Create board service for a room type and the board service
|
||||
# hasn't properties but the room type.
|
||||
# Record of board_service_room_type should contain the
|
||||
# room type properties.
|
||||
|
||||
"""
|
||||
Create board service for a room type and the board service
|
||||
hasn't properties but the room type.
|
||||
Record of board_service_room_type should contain the
|
||||
room type properties.
|
||||
"""
|
||||
# ARRANGE
|
||||
self._create_common_scenario()
|
||||
pms_property2 = self.env["pms.property"].create(
|
||||
{
|
||||
"name": "Property 2",
|
||||
"company_id": self.company1.id,
|
||||
"default_pricelist_id": self.pricelist1.id,
|
||||
}
|
||||
)
|
||||
room_type_double = self.env["pms.room.type"].create(
|
||||
{
|
||||
"pms_property_ids": [self.property1.id, self.property2.id],
|
||||
"pms_property_ids": [self.pms_property1.id, pms_property2.id],
|
||||
"name": "Double Test",
|
||||
"default_code": "DBL_Test",
|
||||
"class_id": self.room_type_class.id,
|
||||
"class_id": self.room_type_class1.id,
|
||||
"price": 25,
|
||||
}
|
||||
)
|
||||
@@ -262,18 +280,18 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
||||
)
|
||||
|
||||
def test_create_rt_no_props_and_bs_no_props(self):
|
||||
# TEST CASE
|
||||
# Create board service for a room type and the board service
|
||||
# has no properties and neither does the room type
|
||||
# Record of board_service_room_type shouldnt contain properties.
|
||||
|
||||
"""
|
||||
Create board service for a room type and the board service
|
||||
has no properties and neither does the room type
|
||||
Record of board_service_room_type shouldnt contain properties.
|
||||
"""
|
||||
# ARRANGE
|
||||
self._create_common_scenario()
|
||||
|
||||
room_type_double = self.env["pms.room.type"].create(
|
||||
{
|
||||
"name": "Double Test",
|
||||
"default_code": "DBL_Test",
|
||||
"class_id": self.room_type_class.id,
|
||||
"class_id": self.room_type_class1.id,
|
||||
"price": 25,
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user