-
-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🛡️ website_multi_company_demo: added test cases with website_price_di…
…fference
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import test_domain_updating | ||
from . import test_website_multi_company |
28 changes: 28 additions & 0 deletions
28
website_multi_company_demo/tests/test_website_multi_company.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
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] | ||
product.website_price_difference # make sure, it does not throw exception | ||
|
||
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'))) |