mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[MIG] report_csv: Migration to 14.0
This commit is contained in:
@@ -25,10 +25,9 @@ class TestReport(common.TransactionCase):
|
||||
|
||||
def test_report(self):
|
||||
# Test if not res:
|
||||
self.env["ir.actions.report"]._get_report_from_name("TEST")
|
||||
report = self.report
|
||||
self.assertEqual(report.report_type, "csv")
|
||||
rep = report.render(self.docs.ids, {})
|
||||
rep = report._render(self.docs.ids, {})
|
||||
str_io = StringIO(rep[0])
|
||||
dict_report = list(csv.DictReader(str_io, delimiter=";", quoting=csv.QUOTE_ALL))
|
||||
self.assertEqual(self.docs.name, dict(dict_report[0])["name"])
|
||||
@@ -39,20 +38,20 @@ class TestReport(common.TransactionCase):
|
||||
objs = self.csv_report._get_objs_for_report(
|
||||
False, {"context": {"active_ids": self.docs.ids}}
|
||||
)
|
||||
self.assertEquals(objs, self.docs)
|
||||
self.assertEqual(objs, self.docs)
|
||||
|
||||
# Typical call from within code not to report_action
|
||||
objs = self.csv_report.with_context(
|
||||
active_ids=self.docs.ids
|
||||
)._get_objs_for_report(False, False)
|
||||
self.assertEquals(objs, self.docs)
|
||||
self.assertEqual(objs, self.docs)
|
||||
|
||||
# Typical call from WebUI
|
||||
objs = self.csv_report._get_objs_for_report(
|
||||
self.docs.ids, {"data": [self.report_name, self.report.report_type]}
|
||||
)
|
||||
self.assertEquals(objs, self.docs)
|
||||
self.assertEqual(objs, self.docs)
|
||||
|
||||
# Typical call from render
|
||||
objs = self.csv_report._get_objs_for_report(self.docs.ids, {})
|
||||
self.assertEquals(objs, self.docs)
|
||||
self.assertEqual(objs, self.docs)
|
||||
|
||||
Reference in New Issue
Block a user