diff --git a/base_report_to_printer/tests/test_ir_actions_report.py b/base_report_to_printer/tests/test_ir_actions_report.py index 683ba04..22c5c04 100644 --- a/base_report_to_printer/tests/test_ir_actions_report.py +++ b/base_report_to_printer/tests/test_ir_actions_report.py @@ -227,14 +227,13 @@ class TestIrActionsReportXml(TransactionCase): 'system_name': 'Tray', 'printer_id': printer.id, } - user_tray = self.new_tray({'system_name':'User tray'}, tray_vals) + user_tray = self.new_tray({'system_name': 'User 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) - # No report passed self.env.user.printer_tray_id = False - options = self.printer.print_options() + options = printer.print_options() self.assertFalse('InputSlot' in options) # No tray defined @@ -248,32 +247,31 @@ class TestIrActionsReportXml(TransactionCase): self.env.user.printer_tray_id = user_tray report.printer_tray_id = False action.printer_tray_id = False - options = report.behaviour() - self.assertIn({'tray': 'User tray'}, options) + self.assertEqual('User tray', report.behaviour()['tray']) # Only report tray is defined self.env.user.printer_tray_id = False report.printer_tray_id = report_tray action.printer_tray_id = False - self.assertIn({'tray': 'Report tray'}, report.behaviour()) + self.assertEqual('Report tray', report.behaviour()['tray']) # Only action tray is defined self.env.user.printer_tray_id = False report.printer_tray_id = False 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 - self.env.user.printer_tray_id = False - report.printer_tray_id = False - action.printer_tray_id = action_tray - self.assertIn({'tray': 'User tray'}, report.behaviour()) + self.env.user.printer_tray_id = user_tray + report.printer_tray_id = report_tray + action.printer_tray_id = False + self.assertEqual('Report tray', report.behaviour()['tray']) # All trays are defined self.env.user.printer_tray_id = user_tray report.printer_tray_id = report_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): action = self.env['ir.actions.report'].new( diff --git a/base_report_to_printer/tests/test_printing_printer.py b/base_report_to_printer/tests/test_printing_printer.py index 0fec88a..bcec2be 100644 --- a/base_report_to_printer/tests/test_printing_printer.py +++ b/base_report_to_printer/tests/test_printing_printer.py @@ -50,8 +50,7 @@ class TestPrintingPrinter(TransactionCase): Noops should return an empty dict """ 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): """ @@ -82,9 +81,8 @@ class TestPrintingPrinter(TransactionCase): report, doc_format='raw', copies=2), {'raw': 'True', 'copies': '2'} ) - self.assertIn('InputSlot', - self.Model.print_options(report, tray='Test').keys() - ) + self.assertTrue('InputSlot' in self.Model.print_options(report, + tray='Test')) @mock.patch('%s.cups' % server_model) def test_print_report(self, cups):