-
-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
printing_auto_stock_picking: fix tests
- Loading branch information
Showing
1 changed file
with
8 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
# Copyright 2022 Michael Tietz (MT Software) <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
import logging | ||
from unittest import mock | ||
|
||
from odoo.exceptions import UserError | ||
|
@@ -14,31 +13,27 @@ | |
) | ||
|
||
|
||
def exception(*args, **kwargs): | ||
return | ||
|
||
|
||
@mock.patch.object(PrintingPrinter, "print_document", print_document) | ||
@mock.patch.object(logging.Logger, "exception", exception) | ||
class TestAutoPrinting(TestPrintingAutoCommon): | ||
@classmethod | ||
def setUpReportAndRecord(cls): | ||
cls.report = cls.env.ref("stock.action_report_delivery") | ||
cls.record = cls.env.ref("stock.outgoing_shipment_main_warehouse") | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.printing_auto = cls._create_printing_auto_attachment() | ||
cls._create_attachment(cls.record, cls.data, "1") | ||
cls.record.picking_type_id.auto_printing_ids |= cls.printing_auto | ||
def setUp(self): | ||
# Note: Using setUpClass, cls.record.picking_type_id.auto_printing_ids | ||
# is reset on each test making them fail | ||
super().setUp() | ||
self.printing_auto = self._create_printing_auto_attachment() | ||
self._create_attachment(self.record, self.data, "1") | ||
self.record.picking_type_id.auto_printing_ids |= self.printing_auto | ||
|
||
def test_action_done_printing_auto(self): | ||
self.printing_auto.printer_id = self.printer_1 | ||
self.record._action_done() | ||
self.assertFalse(self.record.printing_auto_error) | ||
|
||
def test_action_done_printing_error(self): | ||
def test_action_done_printing_error_log(self): | ||
self.record._action_done() | ||
self.assertTrue(self.record.printing_auto_error) | ||
|
||
|