[PORT] Finalize move of printer_tray to base_report_to_printer,

fix tests as report param is not a string but recordset
This commit is contained in:
Graeme Gellatly
2017-10-09 02:10:42 +13:00
committed by Rod Schouteden
parent e0a3b5ca1b
commit 95bf2e4903
2 changed files with 13 additions and 17 deletions

View File

@@ -231,10 +231,9 @@ class TestIrActionsReportXml(TransactionCase):
report_tray = self.new_tray({'system_name': 'Report tray'}, tray_vals) report_tray = self.new_tray({'system_name': 'Report tray'}, tray_vals)
action_tray = self.new_tray({'system_name': 'Action tray'}, tray_vals) action_tray = self.new_tray({'system_name': 'Action tray'}, tray_vals)
# No report passed # No report passed
self.env.user.printer_tray_id = False self.env.user.printer_tray_id = False
options = self.printer.print_options() options = printer.print_options()
self.assertFalse('InputSlot' in options) self.assertFalse('InputSlot' in options)
# No tray defined # No tray defined
@@ -248,32 +247,31 @@ class TestIrActionsReportXml(TransactionCase):
self.env.user.printer_tray_id = user_tray self.env.user.printer_tray_id = user_tray
report.printer_tray_id = False report.printer_tray_id = False
action.printer_tray_id = False action.printer_tray_id = False
options = report.behaviour() self.assertEqual('User tray', report.behaviour()['tray'])
self.assertIn({'tray': 'User tray'}, options)
# Only report tray is defined # Only report tray is defined
self.env.user.printer_tray_id = False self.env.user.printer_tray_id = False
report.printer_tray_id = report_tray report.printer_tray_id = report_tray
action.printer_tray_id = False action.printer_tray_id = False
self.assertIn({'tray': 'Report tray'}, report.behaviour()) self.assertEqual('Report tray', report.behaviour()['tray'])
# Only action tray is defined # Only action tray is defined
self.env.user.printer_tray_id = False self.env.user.printer_tray_id = False
report.printer_tray_id = False report.printer_tray_id = False
action.printer_tray_id = action_tray action.printer_tray_id = action_tray
self.assertIn({'tray': 'Action tray'}, report.behaviour()) self.assertEqual('Action tray', report.behaviour()['tray'])
# User and report tray defined # User and report tray defined
self.env.user.printer_tray_id = False self.env.user.printer_tray_id = user_tray
report.printer_tray_id = False report.printer_tray_id = report_tray
action.printer_tray_id = action_tray action.printer_tray_id = False
self.assertIn({'tray': 'User tray'}, report.behaviour()) self.assertEqual('Report tray', report.behaviour()['tray'])
# All trays are defined # All trays are defined
self.env.user.printer_tray_id = user_tray self.env.user.printer_tray_id = user_tray
report.printer_tray_id = report_tray report.printer_tray_id = report_tray
action.printer_tray_id = action_tray action.printer_tray_id = action_tray
self.assertIn({'tray': 'Action tray'}, report.behaviour()) self.assertEqual('Action tray', report.behaviour()['tray'])
def test_onchange_printer_tray_id_empty(self): def test_onchange_printer_tray_id_empty(self):
action = self.env['ir.actions.report'].new( action = self.env['ir.actions.report'].new(

View File

@@ -49,8 +49,7 @@ class TestPrintingPrinter(TransactionCase):
Noops should return an empty dict Noops should return an empty dict
""" """
self.assertEqual(self.Model._set_option_action(None, 'printer'), {}) self.assertEqual(self.Model._set_option_action(None, 'printer'), {})
self.assertEqual(self.Model._set_option_printer(None, self.printer), self.assertEqual(self.Model._set_option_printer(None, self.Model), {})
{})
def test_option_doc_format(self): def test_option_doc_format(self):
""" """
@@ -82,9 +81,8 @@ class TestPrintingPrinter(TransactionCase):
report, doc_format='raw', copies=2), report, doc_format='raw', copies=2),
{'raw': 'True', 'copies': '2'} {'raw': 'True', 'copies': '2'}
) )
self.assertIn('InputSlot', self.assertTrue('InputSlot' in self.Model.print_options(report,
self.Model.print_options(report, tray='Test').keys() tray='Test'))
)
@mock.patch('%s.cups' % server_model) @mock.patch('%s.cups' % server_model)
def test_print_report(self, cups): def test_print_report(self, cups):