# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import odoo.tests


@odoo.tests.tagged('post_install', '-at_install')
class TestUi(odoo.tests.HttpCase):
    def test_01_admin_shop_tour(self):
        self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('shop')", "odoo.__DEBUG__.services['web_tour.tour'].tours.shop.ready", login="admin")

    def test_02_admin_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="admin")

    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.

@@ -92,16 +92,17 @@
 etails.%0A
+%0A
 import o
@@ -112,16 +112,133 @@
 .tests%0A%0A
+from odoo.addons.website_sale.controllers.main import WebsiteSale%0Afrom odoo.addons.website.tools import MockRequest%0A%0A
 %0A@odoo.t
@@ -966,84 +966,1476 @@
 %22)%0A%0A
-    # TO DO - add public test with new address when convert to web.tour format.
+%0A@odoo.tests.tagged('post_install', '-at_install')%0Aclass TestWebsiteSaleCheckoutAddress(odoo.tests.TransactionCase):%0A    def test_01_edit_billing_address(self):%0A        website = self.env%5B'website'%5D.browse(1)%0A        p = self.env.user.partner_id%0A        so = self.env%5B'sale.order'%5D.create(%7B%0A            'partner_id': p.id,%0A            'website_id': website.id,%0A            'order_line': %5B(0, 0, %7B%0A                'product_id': self.env%5B'product.product'%5D.create(%7B'name': 'Product A', 'list_price': 100%7D).id,%0A                'name': 'Product A',%0A            %7D)%5D%0A        %7D)%0A        country_id = self.env%5B'res.country'%5D.search(%5B%5D, limit=1).id%0A%0A        WebsiteSaleController = WebsiteSale()%0A        with MockRequest(self.env, website=website, sale_order_id=so.id):%0A            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)%0A            self.assertFalse(p.website_id, %22Partner should not have a website set on him after editing billing.%22)%0A%0A        website.specific_user_account = True%0A        with MockRequest(self.env, website=website, sale_order_id=so.id):%0A            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)%0A            self.assertEqual(p.website_id, website, %22Partner should have a website set on him after editing billing.%22)
 %0A

add tests