[FIX] website_sale: make add_to_cart_snippet_tour run as expected

Add a setUpClass with a dummy payment provider to ensure that at
least one is always available when the tour is running, and set
the company country_id to None before starting the tour to avoid
any country dependant fields to block the tour during the checkout
process.

closes odoo/odoo#105700

X-original-commit: 779965fbf0471f2b003692f1afa541864a396651
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
This commit is contained in:
Nicolas (vin)
2022-11-14 17:18:11 +01:00
parent 08094099dc
commit 9168a8e73b
@@ -5,5 +5,32 @@ from odoo.tests import HttpCase, tagged
@tagged('post_install', '-at_install')
class TestAddToCartSnippet(HttpCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
# Create a dummy payment provider to ensure that the tour has at least one available to it.
arch = """
<form action="dummy" method="post">
<input type="hidden" name="view_id" t-att-value="viewid"/>
<input type="hidden" name="user_id" t-att-value="user_id.id"/>
</form>
"""
redirect_form = cls.env['ir.ui.view'].create({
'name': "Dummy Redirect Form",
'type': 'qweb',
'arch': arch,
})
cls.dummy_provider = cls.env['payment.provider'].create({
'name': "Dummy Provider",
'code': 'none',
'state': 'test',
'is_published': True,
'allow_tokenization': True,
'redirect_form_view_id': redirect_form.id,
})
def test_configure_product(self):
# Reset the company country id, which ensure that no country dependant fields are blocking the address form.
self.env.company.country_id = self.env.ref('base.us')
self.start_tour("/", 'add_to_cart_snippet_tour', login="admin")