mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[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:
committed by
Rod Schouteden
parent
e0a3b5ca1b
commit
95bf2e4903
@@ -227,14 +227,13 @@ class TestIrActionsReportXml(TransactionCase):
|
|||||||
'system_name': 'Tray',
|
'system_name': 'Tray',
|
||||||
'printer_id': printer.id,
|
'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)
|
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(
|
||||||
|
|||||||
@@ -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):
|
||||||
|
|||||||
Reference in New Issue
Block a user