Skip to content

Commit

Permalink
printing_auto_stock_picking: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaudoux committed Dec 6, 2024
1 parent 378f6f7 commit 42b597b
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions printing_auto_stock_picking/tests/test_printing_auto_stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Check warning on line 18 in printing_auto_stock_picking/tests/test_printing_auto_stock.py

View check run for this annotation

Codecov / codecov/patch

printing_auto_stock_picking/tests/test_printing_auto_stock.py#L17-L18

Added lines #L17 - L18 were not covered by tests
def setUpReportAndRecord(cls):
cls.report = cls.env.ref("stock.action_report_delivery")
cls.record = cls.env.ref("stock.outgoing_shipment_main_warehouse")

Check warning on line 21 in printing_auto_stock_picking/tests/test_printing_auto_stock.py

View check run for this annotation

Codecov / codecov/patch

printing_auto_stock_picking/tests/test_printing_auto_stock.py#L20-L21

Added lines #L20 - L21 were not covered by tests

@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):

Check warning on line 23 in printing_auto_stock_picking/tests/test_printing_auto_stock.py

View check run for this annotation

Codecov / codecov/patch

printing_auto_stock_picking/tests/test_printing_auto_stock.py#L23

Added line #L23 was not covered by tests
# 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

Check warning on line 29 in printing_auto_stock_picking/tests/test_printing_auto_stock.py

View check run for this annotation

Codecov / codecov/patch

printing_auto_stock_picking/tests/test_printing_auto_stock.py#L26-L29

Added lines #L26 - L29 were not covered by tests

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)

Check warning on line 34 in printing_auto_stock_picking/tests/test_printing_auto_stock.py

View check run for this annotation

Codecov / codecov/patch

printing_auto_stock_picking/tests/test_printing_auto_stock.py#L31-L34

Added lines #L31 - L34 were not covered by tests

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)

Check warning on line 38 in printing_auto_stock_picking/tests/test_printing_auto_stock.py

View check run for this annotation

Codecov / codecov/patch

printing_auto_stock_picking/tests/test_printing_auto_stock.py#L36-L38

Added lines #L36 - L38 were not covered by tests

Expand Down

0 comments on commit 42b597b

Please sign in to comment.