Skip to content

Commit 24921d6

Browse files
paan-odoovlst-odoo
authored andcommitted
[IMP] pos_loyalty: replace start_tour with start_pos_tour
In this commit: - We are replacing start_tour with strat_pos_tour. task-4766756
1 parent 91b0623 commit 24921d6

File tree

1 file changed

+23
-111
lines changed

1 file changed

+23
-111
lines changed

addons/pos_loyalty/tests/test_frontend.py

Lines changed: 23 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,7 @@ def test_loyalty_free_product_loyalty_program(self):
360360
'points': 100,
361361
})
362362

363-
self.start_tour(
364-
"/pos/ui/%d" % self.main_pos_config.id,
365-
"PosLoyaltyChangeRewardQty",
366-
login="pos_user",
367-
)
363+
self.start_pos_tour("PosLoyaltyChangeRewardQty")
368364

369365
def test_loyalty_free_product_zero_sale_price_loyalty_program(self):
370366
# In this program, each $ spent gives 1 point.
@@ -1340,7 +1336,7 @@ def test_promotion_program_with_loyalty_program(self):
13401336

13411337
self.main_pos_config.open_ui()
13421338

1343-
self.start_pos_tour("PosLoyaltyPromotion", login="pos_admin")
1339+
self.start_pos_tour("PosLoyaltyPromotion")
13441340

13451341
def test_promo_with_free_product(self):
13461342
self.env['loyalty.program'].search([]).write({'active': False})
@@ -1669,11 +1665,7 @@ def test_loyalty_program_with_tagged_buy_x_get_y(self):
16691665
})
16701666

16711667
self.main_pos_config.open_ui()
1672-
self.start_tour(
1673-
"/pos/ui/%d" % self.main_pos_config.id,
1674-
"PosLoyaltyTour12",
1675-
login="pos_user",
1676-
)
1668+
self.start_pos_tour("PosLoyaltyTour12")
16771669

16781670
def test_promotion_with_min_amount_and_specific_product_rule(self):
16791671
"""
@@ -1714,11 +1706,7 @@ def test_promotion_with_min_amount_and_specific_product_rule(self):
17141706
})
17151707

17161708
self.main_pos_config.open_ui()
1717-
self.start_tour(
1718-
'/pos/ui/%d' % self.main_pos_config.id,
1719-
'PosLoyaltyMinAmountAndSpecificProductTour',
1720-
login='pos_user',
1721-
)
1709+
self.start_pos_tour('PosLoyaltyMinAmountAndSpecificProductTour')
17221710

17231711
def test_gift_card_price_no_tax(self):
17241712
"""
@@ -1748,11 +1736,7 @@ def test_gift_card_price_no_tax(self):
17481736
gift_card_program.coupon_ids.code = '043123456'
17491737

17501738
# Run the tour. It will use the gift card.
1751-
self.start_tour(
1752-
"/pos/ui/%d" % self.main_pos_config.id,
1753-
"GiftCardProgramPriceNoTaxTour",
1754-
login="pos_user"
1755-
)
1739+
self.start_pos_tour("GiftCardProgramPriceNoTaxTour")
17561740

17571741
def test_physical_gift_card_sale(self):
17581742
"""
@@ -1767,11 +1751,7 @@ def test_physical_gift_card_sale(self):
17671751
gift_card_program = self.create_programs([('arbitrary_name', 'gift_card')])['arbitrary_name']
17681752

17691753
# Run the tour
1770-
self.start_tour(
1771-
"/pos/ui/%d" % self.main_pos_config.id,
1772-
"PhysicalGiftCardProgramSaleTour",
1773-
login="pos_user"
1774-
)
1754+
self.start_pos_tour("PhysicalGiftCardProgramSaleTour")
17751755

17761756
expected_coupons = {
17771757
"test-card-0000": 125,
@@ -1833,11 +1813,7 @@ def test_dont_grant_points_reward_order_lines(self):
18331813
})
18341814

18351815
self.main_pos_config.open_ui()
1836-
self.start_tour(
1837-
"/pos/ui/%d" % self.main_pos_config.id,
1838-
"PosLoyaltyDontGrantPointsForRewardOrderLines",
1839-
login="pos_user",
1840-
)
1816+
self.start_pos_tour("PosLoyaltyDontGrantPointsForRewardOrderLines")
18411817

18421818
loyalty_card = loyalty_program.coupon_ids.filtered(lambda coupon: coupon.partner_id.id == partner.id)
18431819

@@ -1874,11 +1850,7 @@ def test_points_awarded_global_discount_code_no_domain_program(self):
18741850
})
18751851

18761852
self.main_pos_config.open_ui()
1877-
self.start_tour(
1878-
"/pos/ui/%d" % self.main_pos_config.id,
1879-
"PosLoyaltyPointsGlobalDiscountProgramNoDomain",
1880-
login="pos_user",
1881-
)
1853+
self.start_pos_tour("PosLoyaltyPointsGlobalDiscountProgramNoDomain")
18821854
self.assertEqual(loyalty_card.points, 90)
18831855

18841856
def test_points_awarded_discount_code_no_domain_program(self):
@@ -1921,11 +1893,7 @@ def test_points_awarded_discount_code_no_domain_program(self):
19211893
})
19221894

19231895
self.main_pos_config.open_ui()
1924-
self.start_tour(
1925-
"/pos/ui/%d" % self.main_pos_config.id,
1926-
"PosLoyaltyPointsDiscountNoDomainProgramNoDomain",
1927-
login="pos_user",
1928-
)
1896+
self.start_pos_tour("PosLoyaltyPointsDiscountNoDomainProgramNoDomain")
19291897
self.assertEqual(loyalty_card.points, 135)
19301898

19311899
def test_points_awarded_general_discount_code_specific_domain_program(self):
@@ -1978,11 +1946,7 @@ def test_points_awarded_general_discount_code_specific_domain_program(self):
19781946
})
19791947

19801948
self.main_pos_config.open_ui()
1981-
self.start_tour(
1982-
"/pos/ui/%d" % self.main_pos_config.id,
1983-
"PosLoyaltyPointsDiscountNoDomainProgramDomain",
1984-
login="pos_user",
1985-
)
1949+
self.start_pos_tour("PosLoyaltyPointsDiscountNoDomainProgramDomain")
19861950
self.assertEqual(loyalty_card.points, 100)
19871951

19881952
def test_points_awarded_specific_discount_code_specific_domain_program(self):
@@ -2040,11 +2004,7 @@ def test_points_awarded_specific_discount_code_specific_domain_program(self):
20402004
discount_product.available_in_pos = True
20412005

20422006
self.main_pos_config.open_ui()
2043-
self.start_tour(
2044-
"/pos/ui/%d" % self.main_pos_config.id,
2045-
"PosLoyaltyPointsDiscountWithDomainProgramDomain",
2046-
login="pos_user",
2047-
)
2007+
self.start_pos_tour("PosLoyaltyPointsDiscountWithDomainProgramDomain")
20482008
self.assertEqual(loyalty_card.points, 90)
20492009

20502010
def test_points_awarded_ewallet(self):
@@ -2130,11 +2090,7 @@ def test_points_awarded_giftcard(self):
21302090
})
21312091

21322092
self.main_pos_config.open_ui()
2133-
self.start_tour(
2134-
"/pos/ui/%d" % self.main_pos_config.id,
2135-
"PosLoyaltyPointsGiftcard",
2136-
login="pos_user",
2137-
)
2093+
self.start_pos_tour("PosLoyaltyPointsGiftcard")
21382094
self.assertEqual(loyalty_card.points, 100)
21392095

21402096
def test_archived_reward_products(self):
@@ -2191,20 +2147,12 @@ def test_archived_reward_products(self):
21912147
self.product_b.active = False
21922148
product_c.active = False
21932149

2194-
self.start_tour(
2195-
"/pos/ui/%d" % self.main_pos_config.id,
2196-
"PosLoyaltyArchivedRewardProductsInactive",
2197-
login="pos_user",
2198-
)
2150+
self.start_pos_tour("PosLoyaltyArchivedRewardProductsInactive")
21992151
current_session_id = self.main_pos_config.current_session_id
22002152
current_session_id.post_closing_cash_details(100.0)
22012153
current_session_id.close_session_from_ui()
22022154
product_c.active = True
2203-
self.start_tour(
2204-
"/pos/ui/%d" % self.main_pos_config.id,
2205-
"PosLoyaltyArchivedRewardProductsActive",
2206-
login="pos_user"
2207-
)
2155+
self.start_pos_tour("PosLoyaltyArchivedRewardProductsActive")
22082156

22092157
def test_change_reward_value_with_language(self):
22102158
"""
@@ -2243,11 +2191,7 @@ def test_change_reward_value_with_language(self):
22432191
loyalty_program.reward_ids.update_field_translations('description', {'en_US': 'A en_US name which should not be displayed'})
22442192

22452193
self.main_pos_config.open_ui()
2246-
self.start_tour(
2247-
"/pos/ui/%d" % self.main_pos_config.id,
2248-
"ChangeRewardValueWithLanguage",
2249-
login="pos_user",
2250-
)
2194+
self.start_pos_tour("ChangeRewardValueWithLanguage")
22512195

22522196
def test_loyalty_reward_product_tag(self):
22532197
"""
@@ -2280,11 +2224,7 @@ def test_loyalty_reward_product_tag(self):
22802224
})
22812225

22822226
self.main_pos_config.open_ui()
2283-
self.start_tour(
2284-
"/pos/ui/%d" % self.main_pos_config.id,
2285-
"PosLoyaltyRewardProductTag",
2286-
login="pos_user",
2287-
)
2227+
self.start_pos_tour("PosLoyaltyRewardProductTag")
22882228

22892229
def test_gift_card_rewards_using_taxes(self):
22902230
"""
@@ -2308,11 +2248,7 @@ def test_gift_card_rewards_using_taxes(self):
23082248
gift_card_program.payment_program_discount_product_id.taxes_id = self.tax01
23092249

23102250
self.main_pos_config.open_ui()
2311-
self.start_tour(
2312-
"/pos/ui/%d" % self.main_pos_config.id,
2313-
"PosLoyaltyGiftCardTaxes",
2314-
login="accountman",
2315-
)
2251+
self.start_pos_tour("PosLoyaltyGiftCardTaxes", login="accountman")
23162252
self.main_pos_config.current_session_id.close_session_from_ui()
23172253

23182254
def test_customer_loyalty_points_displayed(self):
@@ -2425,11 +2361,7 @@ def test_apply_reward_on_product_scan(self):
24252361
'pos_config_ids': [Command.link(self.main_pos_config.id)],
24262362
})
24272363
self.main_pos_config.with_user(self.pos_admin).open_ui()
2428-
self.start_tour(
2429-
"/pos/ui/%d" % self.main_pos_config.id,
2430-
"PosRewardProductScan",
2431-
login="pos_admin"
2432-
)
2364+
self.start_pos_tour("PosRewardProductScan", login="pos_admin")
24332365

24342366
# Check that there should be one paid order with reward line and not draft order
24352367
current_session_id = self.main_pos_config.current_session_id
@@ -2444,11 +2376,7 @@ def test_apply_reward_on_product_scan(self):
24442376
# check the same flow with gs1 nomenclature
24452377
self.env.company.nomenclature_id = self.env.ref('barcodes_gs1_nomenclature.default_gs1_nomenclature')
24462378
self.main_pos_config.with_user(self.pos_admin).open_ui()
2447-
self.start_tour(
2448-
"/pos/ui/%d" % self.main_pos_config.id,
2449-
"PosRewardProductScanGS1",
2450-
login="pos_admin"
2451-
)
2379+
self.start_pos_tour("PosRewardProductScanGS1", login="pos_admin")
24522380

24532381
# Check that there should be one paid order with reward line and not draft order
24542382
current_session_id = self.main_pos_config.current_session_id
@@ -2531,11 +2459,7 @@ def test_gift_card_program_create_with_invoice(self):
25312459
self.env['res.partner'].create({'name': 'A Test Partner'})
25322460

25332461
self.main_pos_config.with_user(self.pos_user).open_ui()
2534-
self.start_tour(
2535-
"/pos/ui/%d" % self.main_pos_config.id,
2536-
"GiftCardProgramInvoice",
2537-
login="pos_user",
2538-
)
2462+
self.start_pos_tour("GiftCardProgramInvoice")
25392463
self.assertEqual(len(gift_card_program.coupon_ids), 1)
25402464

25412465
def test_refund_product_part_of_rules(self):
@@ -2561,11 +2485,7 @@ def test_refund_product_part_of_rules(self):
25612485
})
25622486

25632487
self.main_pos_config.with_user(self.pos_user).open_ui()
2564-
self.start_tour(
2565-
"/pos/ui/%d" % self.main_pos_config.id,
2566-
"RefundRulesProduct",
2567-
login="pos_user",
2568-
)
2488+
self.start_pos_tour("RefundRulesProduct")
25692489

25702490
def test_cheapest_product_tax_included(self):
25712491
tax_01 = self.env['account.tax'].create({
@@ -2623,11 +2543,7 @@ def test_next_order_coupon_program_expiration_date(self):
26232543
})
26242544

26252545
self.main_pos_config.with_user(self.pos_user).open_ui()
2626-
self.start_tour(
2627-
"/pos/ui/%d" % self.main_pos_config.id,
2628-
"PosLoyaltyNextOrderCouponExpirationDate",
2629-
login="pos_user",
2630-
)
2546+
self.start_pos_tour("PosLoyaltyNextOrderCouponExpirationDate")
26312547

26322548
coupon = loyalty_program.coupon_ids
26332549
self.assertEqual(len(coupon), 1, "Coupon not generated")
@@ -2704,11 +2620,7 @@ def test_physical_gift_card_invoiced(self):
27042620
gift_card_program = self.create_programs([('arbitrary_name', 'gift_card')])['arbitrary_name']
27052621

27062622
# Run the tour
2707-
self.start_tour(
2708-
"/pos/web?config_id=%d" % self.main_pos_config.id,
2709-
"test_physical_gift_card_invoiced",
2710-
login="pos_user",
2711-
)
2623+
self.start_pos_tour("test_physical_gift_card_invoiced")
27122624

27132625
self.assertEqual(len(gift_card_program.coupon_ids), 1, "Gift card not generated")
27142626
self.assertEqual(gift_card_program.coupon_ids[0].code, "test-card-1234", "Gift card code not correct")

0 commit comments

Comments
 (0)