Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
🛡️ website_multi_company_demo: added test cases with website_price_di…
…fference
  • Loading branch information
em230418 committed Jul 29, 2019
1 parent 97a415d commit 15d995e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions website_multi_company_demo/tests/__init__.py
@@ -1 +1,2 @@
from . import test_domain_updating
from . import test_website_multi_company
29 changes: 29 additions & 0 deletions website_multi_company_demo/tests/test_website_multi_company.py
@@ -0,0 +1,29 @@
from odoo.tests.common import SingleTransactionCase, get_db_name, at_install, post_install
from ..models.res_users import WEBSITE_REFS
from odoo.api import Environment

db_name = get_db_name()


@at_install(True)
@post_install(True)
class TestWebsiteMultiCompany(SingleTransactionCase):

def _test_website_price_difference_is_accessible(self, env):
website = env.ref(WEBSITE_REFS[0])
products = env['product.template'].search(
[('company_id', '=', website.company_id.id)] +
website.sale_product_domain()
)
product = products[0]
# make sure, it does not throw exception
product.website_price_difference # pylint: disable=pointless-statement

def test_website_price_difference_is_accessible_for_demo_user(self):
uid = self.registry['res.users'].authenticate(db_name, 'demo', 'demo', {})
with self.cursor() as cr:
env = Environment(cr, uid, {})
self._test_website_price_difference_is_accessible(env)

def test_website_price_difference_is_accessible_for_public_user(self):
self._test_website_price_difference_is_accessible(self.env(user=self.browse_ref('base.public_user')))

0 comments on commit 15d995e

Please sign in to comment.