[FIX] website_sale: add tests
Parent commit moved needed functions into misc so this test could use those. This test is for parent's parent commit which fix checkout billing address edition. Part of #34396
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import odoo.tests
|
||||
|
||||
from odoo.addons.website_sale.controllers.main import WebsiteSale
|
||||
from odoo.addons.website.tools import MockRequest
|
||||
|
||||
|
||||
@odoo.tests.tagged('post_install', '-at_install')
|
||||
class TestUi(odoo.tests.HttpCase):
|
||||
@@ -14,4 +18,28 @@ class TestUi(odoo.tests.HttpCase):
|
||||
def test_03_demo_checkout(self):
|
||||
self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('shop_buy_product')", "odoo.__DEBUG__.services['web_tour.tour'].tours.shop_buy_product.ready", login="demo")
|
||||
|
||||
# TO DO - add public test with new address when convert to web.tour format.
|
||||
|
||||
@odoo.tests.tagged('post_install', '-at_install')
|
||||
class TestWebsiteSaleCheckoutAddress(odoo.tests.TransactionCase):
|
||||
def test_01_edit_billing_address(self):
|
||||
website = self.env['website'].browse(1)
|
||||
p = self.env.user.partner_id
|
||||
so = self.env['sale.order'].create({
|
||||
'partner_id': p.id,
|
||||
'website_id': website.id,
|
||||
'order_line': [(0, 0, {
|
||||
'product_id': self.env['product.product'].create({'name': 'Product A', 'list_price': 100}).id,
|
||||
'name': 'Product A',
|
||||
})]
|
||||
})
|
||||
country_id = self.env['res.country'].search([], limit=1).id
|
||||
|
||||
WebsiteSaleController = WebsiteSale()
|
||||
with MockRequest(self.env, website=website, sale_order_id=so.id):
|
||||
WebsiteSaleController.address(name='website_sale test user', email='email@email.email', street='ooo', city='ooo', country_id=country_id, submitted=1, partner_id=p.id)
|
||||
self.assertFalse(p.website_id, "Partner should not have a website set on him after editing billing.")
|
||||
|
||||
website.specific_user_account = True
|
||||
with MockRequest(self.env, website=website, sale_order_id=so.id):
|
||||
WebsiteSaleController.address(name='website_sale test user', email='email@email.email', street='ooo', city='ooo', country_id=country_id, submitted=1, partner_id=p.id)
|
||||
self.assertEqual(p.website_id, website, "Partner should have a website set on him after editing billing.")
|
||||
|
||||
Reference in New Issue
Block a user