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):
|
class TestPmsBoardService(TestPms):
|
||||||
def setUp(self):
|
|
||||||
super().setUp()
|
|
||||||
|
|
||||||
def test_pms_board_service_line_product_property_integrity(self):
|
def test_pms_board_service_line_product_property_integrity(self):
|
||||||
"""
|
"""
|
||||||
Creation of a board service line without property, of a product
|
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):
|
class TestPmsBoardServiceRoomType(TestPms):
|
||||||
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
|
# def _create_common_scenario(self):
|
||||||
self.room_type_class = self.env["pms.room.type.class"].create(
|
# self.company1 = self.env["res.company"].create(
|
||||||
{"name": "Room", "default_code": "ROOM"}
|
# {
|
||||||
)
|
# "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):
|
def test_create_rt_props_gt_bs_props(self):
|
||||||
# TEST CASE
|
"""
|
||||||
# Create board service for a room type and the room type
|
Create board service for a room type and the room type
|
||||||
# have MORE properties than the board service.
|
have MORE properties than the board service.
|
||||||
# Record of board_service_room_type should contain the
|
Record of board_service_room_type should contain the
|
||||||
# board service properties.
|
board service properties.
|
||||||
|
"""
|
||||||
# ARRANGE
|
# 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(
|
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",
|
"name": "Double Test",
|
||||||
"default_code": "DBL_Test",
|
"default_code": "DBL_Test",
|
||||||
"class_id": self.room_type_class.id,
|
"class_id": self.room_type_class1.id,
|
||||||
"price": 25,
|
"price": 25,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -83,7 +91,7 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
|||||||
{
|
{
|
||||||
"name": "Test Board Service",
|
"name": "Test Board Service",
|
||||||
"default_code": "TPS",
|
"default_code": "TPS",
|
||||||
"pms_property_ids": [self.property1.id],
|
"pms_property_ids": [self.pms_property1.id],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
# ACT
|
# ACT
|
||||||
@@ -102,20 +110,26 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_create_rt_props_lt_bs_props(self):
|
def test_create_rt_props_lt_bs_props(self):
|
||||||
# TEST CASE
|
"""
|
||||||
# Create board service for a room type and the room type
|
Create board service for a room type and the room type
|
||||||
# have LESS properties than the board service.
|
have LESS properties than the board service.
|
||||||
# Record of board_service_room_type should contain the
|
Record of board_service_room_type should contain the
|
||||||
# room types properties.
|
room types properties.
|
||||||
|
"""
|
||||||
# ARRANGE
|
# 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(
|
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",
|
"name": "Double Test",
|
||||||
"default_code": "DBL_Test",
|
"default_code": "DBL_Test",
|
||||||
"class_id": self.room_type_class.id,
|
"class_id": self.room_type_class1.id,
|
||||||
"price": 25,
|
"price": 25,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -123,7 +137,7 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
|||||||
{
|
{
|
||||||
"name": "Test Board Service",
|
"name": "Test Board Service",
|
||||||
"default_code": "TPS",
|
"default_code": "TPS",
|
||||||
"pms_property_ids": [self.property1.id, self.property2.id],
|
"pms_property_ids": [self.pms_property1.id, pms_property2.id],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
# ACT
|
# ACT
|
||||||
@@ -142,21 +156,20 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_create_rt_props_eq_bs_props(self):
|
def test_create_rt_props_eq_bs_props(self):
|
||||||
# TEST CASE
|
"""
|
||||||
# Create board service for a room type and the room type
|
Create board service for a room type and the room type
|
||||||
# have THE SAME properties than the board service.
|
have THE SAME properties than the board service.
|
||||||
# Record of board_service_room_type should contain the
|
Record of board_service_room_type should contain the
|
||||||
# room types properties that matchs with the board
|
room types properties that matchs with the board
|
||||||
# service properties
|
service properties
|
||||||
|
"""
|
||||||
# ARRANGE
|
# ARRANGE
|
||||||
self._create_common_scenario()
|
|
||||||
room_type_double = self.env["pms.room.type"].create(
|
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",
|
"name": "Double Test",
|
||||||
"default_code": "DBL_Test",
|
"default_code": "DBL_Test",
|
||||||
"class_id": self.room_type_class.id,
|
"class_id": self.room_type_class1.id,
|
||||||
"price": 25,
|
"price": 25,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -164,7 +177,7 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
|||||||
{
|
{
|
||||||
"name": "Test Board Service",
|
"name": "Test Board Service",
|
||||||
"default_code": "TPS",
|
"default_code": "TPS",
|
||||||
"pms_property_ids": [self.property1.id],
|
"pms_property_ids": [self.pms_property1.id],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
# ACT
|
# ACT
|
||||||
@@ -184,19 +197,18 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_create_rt_no_props_and_bs_props(self):
|
def test_create_rt_no_props_and_bs_props(self):
|
||||||
# TEST CASE
|
"""
|
||||||
# Create board service for a room type and the room type
|
Create board service for a room type and the room type
|
||||||
# hasn't properties but the board services.
|
hasn't properties but the board services.
|
||||||
# Record of board_service_room_type should contain the
|
Record of board_service_room_type should contain the
|
||||||
# board service properties.
|
board service properties.
|
||||||
|
"""
|
||||||
# ARRANGE
|
# ARRANGE
|
||||||
self._create_common_scenario()
|
|
||||||
room_type_double = self.env["pms.room.type"].create(
|
room_type_double = self.env["pms.room.type"].create(
|
||||||
{
|
{
|
||||||
"name": "Double Test",
|
"name": "Double Test",
|
||||||
"default_code": "DBL_Test",
|
"default_code": "DBL_Test",
|
||||||
"class_id": self.room_type_class.id,
|
"class_id": self.room_type_class1.id,
|
||||||
"price": 25,
|
"price": 25,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -204,7 +216,7 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
|||||||
{
|
{
|
||||||
"name": "Test Board Service",
|
"name": "Test Board Service",
|
||||||
"default_code": "TPS",
|
"default_code": "TPS",
|
||||||
"pms_property_ids": [self.property1.id],
|
"pms_property_ids": [self.pms_property1.id],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
# ACT
|
# ACT
|
||||||
@@ -223,20 +235,26 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_create_rt_props_and_bs_no_props(self):
|
def test_create_rt_props_and_bs_no_props(self):
|
||||||
# TEST CASE
|
"""
|
||||||
# Create board service for a room type and the board service
|
Create board service for a room type and the board service
|
||||||
# hasn't properties but the room type.
|
hasn't properties but the room type.
|
||||||
# Record of board_service_room_type should contain the
|
Record of board_service_room_type should contain the
|
||||||
# room type properties.
|
room type properties.
|
||||||
|
"""
|
||||||
# ARRANGE
|
# 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(
|
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",
|
"name": "Double Test",
|
||||||
"default_code": "DBL_Test",
|
"default_code": "DBL_Test",
|
||||||
"class_id": self.room_type_class.id,
|
"class_id": self.room_type_class1.id,
|
||||||
"price": 25,
|
"price": 25,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -262,18 +280,18 @@ class TestPmsBoardServiceRoomType(common.SavepointCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_create_rt_no_props_and_bs_no_props(self):
|
def test_create_rt_no_props_and_bs_no_props(self):
|
||||||
# TEST CASE
|
"""
|
||||||
# Create board service for a room type and the board service
|
Create board service for a room type and the board service
|
||||||
# has no properties and neither does the room type
|
has no properties and neither does the room type
|
||||||
# Record of board_service_room_type shouldnt contain properties.
|
Record of board_service_room_type shouldnt contain properties.
|
||||||
|
"""
|
||||||
# ARRANGE
|
# ARRANGE
|
||||||
self._create_common_scenario()
|
|
||||||
room_type_double = self.env["pms.room.type"].create(
|
room_type_double = self.env["pms.room.type"].create(
|
||||||
{
|
{
|
||||||
"name": "Double Test",
|
"name": "Double Test",
|
||||||
"default_code": "DBL_Test",
|
"default_code": "DBL_Test",
|
||||||
"class_id": self.room_type_class.id,
|
"class_id": self.room_type_class1.id,
|
||||||
"price": 25,
|
"price": 25,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user