Browse Source
Merge pull request #1098 from tarteo/12-imp-tests-export-group
[12.0][IMP] web_disable_export_group: Tests
pull/1104/head
Simone Orsi
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
34 additions and
0 deletions
-
web_disable_export_group/tests/__init__.py
-
web_disable_export_group/tests/test_disable_export_group.py
|
|
@ -0,0 +1 @@ |
|
|
|
from . import test_disable_export_group |
|
|
@ -0,0 +1,33 @@ |
|
|
|
# Copyright 2018 Onestein |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
|
|
|
|
from mock import patch |
|
|
|
from odoo.api import Environment |
|
|
|
from odoo.tests.common import SavepointCase |
|
|
|
|
|
|
|
|
|
|
|
class TestDisableExportGroup(SavepointCase): |
|
|
|
@patch('odoo.addons.web_disable_export_group.models.ir_http.request') |
|
|
|
@patch('odoo.addons.web.models.ir_http.request') |
|
|
|
@patch('odoo.addons.web_tour.models.ir_http.request') |
|
|
|
def test_session_info(self, request, request1, request2): |
|
|
|
request.env = self.env |
|
|
|
request1.env = self.env |
|
|
|
request2.env = self.env |
|
|
|
session_info = self.env['ir.http'].session_info() |
|
|
|
self.assertTrue(session_info['group_export_data']) |
|
|
|
|
|
|
|
@patch('odoo.addons.web_disable_export_group.models.ir_http.request') |
|
|
|
@patch('odoo.addons.web.models.ir_http.request') |
|
|
|
@patch('odoo.addons.web_tour.models.ir_http.request') |
|
|
|
def test_session_info_not_allowed(self, request, request1, request2): |
|
|
|
demo_env = Environment( |
|
|
|
self.env.cr, |
|
|
|
self.env.ref('base.default_user').id, |
|
|
|
{} |
|
|
|
) |
|
|
|
request.env = demo_env |
|
|
|
request1.env = demo_env |
|
|
|
request2.env = demo_env |
|
|
|
session_info = demo_env['ir.http'].session_info() |
|
|
|
self.assertFalse(session_info['group_export_data']) |