[MIG] report_webkit: converted test case from yml to python

This commit is contained in:
Rashik Kalathiya
2016-08-02 11:51:35 +02:00
committed by Yannick Tivisse
parent bc3d12c619
commit 0a069610fb
4 changed files with 21 additions and 19 deletions
-3
View File
@@ -69,8 +69,5 @@ TODO:
'demo': [
"report/webkit_report_demo.xml",
],
'test': [
"test/print.yml",
],
'auto_install': False,
}
+1 -1
View File
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import test_report_webkit
import test_report_webkit_demo
@@ -1,15 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import os
import odoo.tests
from odoo import tools
from odoo.report import render_report
class TestReportsWebkit(odoo.tests.TransactionCase):
def test_report_webkit(self):
report_ids = self.env['ir.actions.report.xml'].search([]).ids
data, format = render_report(self.env.cr, self.env.uid, report_ids, 'webkit.ir.actions.report.xml', {}, context=self.env.context)
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'report_webkit_demo_report.' + format), 'wb+').write(data)
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import os
from odoo import tools
from odoo.tests import common
class TestReportWebkit(common.TransactionCase):
"""Print the report_webkit demo report."""
def setUp(self):
super(TestReportWebkit, self).setUp()
self.IrActionsReportXml = self.env['ir.actions.report.xml']
def test_00_print_report_webkit(self):
action_reports = self.IrActionsReportXml.search([])
data, format = self.IrActionsReportXml.render_report(action_reports.ids, 'webkit.ir.actions.report.xml', {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'report_webkit_demo_report.'+format), 'wb+').write(data)