mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[13.0][MIG] report_context
This commit is contained in:
committed by
Pierrick Brun
parent
4d8f393d1e
commit
99bb8ac22c
@@ -12,7 +12,9 @@ class TestReportContext(TransactionCase):
|
||||
)
|
||||
report.write({"context": '{"test_parameter": 2}'})
|
||||
action = report.with_context(test_parameter=3).report_action(company)
|
||||
self.assertEqual(3, action["context"]["test_parameter"])
|
||||
self.assertEqual(
|
||||
3, action["context"]["report_action"]["context"]["test_parameter"]
|
||||
)
|
||||
|
||||
def test_report_02(self):
|
||||
company = self.browse_ref("base.main_company")
|
||||
@@ -22,7 +24,9 @@ class TestReportContext(TransactionCase):
|
||||
)
|
||||
report.write({"context": '{"test_parameter": 2}'})
|
||||
action = report.report_action(company)
|
||||
self.assertEqual(2, action["context"]["test_parameter"])
|
||||
self.assertEqual(
|
||||
2, action["context"]["report_action"]["context"]["test_parameter"]
|
||||
)
|
||||
|
||||
def test_report_03(self):
|
||||
company = self.browse_ref("base.main_company")
|
||||
@@ -31,14 +35,18 @@ class TestReportContext(TransactionCase):
|
||||
"report.default.context", '{"test_parameter": 1}'
|
||||
)
|
||||
action = report.with_context(test_parameter=3).report_action(company)
|
||||
self.assertEqual(3, action["context"]["test_parameter"])
|
||||
self.assertEqual(
|
||||
3, action["context"]["report_action"]["context"]["test_parameter"]
|
||||
)
|
||||
|
||||
def test_report_04(self):
|
||||
company = self.browse_ref("base.main_company")
|
||||
report = self.browse_ref("web.action_report_internalpreview")
|
||||
report.write({"context": '{"test_parameter": 2}'})
|
||||
action = report.report_action(company)
|
||||
self.assertEqual(2, action["context"]["test_parameter"])
|
||||
self.assertEqual(
|
||||
2, action["context"]["report_action"]["context"]["test_parameter"]
|
||||
)
|
||||
|
||||
def test_report_05(self):
|
||||
company = self.browse_ref("base.main_company")
|
||||
@@ -47,4 +55,6 @@ class TestReportContext(TransactionCase):
|
||||
"report.default.context", '{"test_parameter": 1}'
|
||||
)
|
||||
action = report.report_action(company)
|
||||
self.assertEqual(1, action["context"]["test_parameter"])
|
||||
self.assertEqual(
|
||||
1, action["context"]["report_action"]["context"]["test_parameter"]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user