[IMP] update dotfiles [ci skip]

This commit is contained in:
oca-git-bot
2022-03-31 17:22:14 +02:00
committed by Nils Hamerlinck
parent 0a36c57ff5
commit b0816532e8
6 changed files with 42 additions and 42 deletions

View File

@@ -34,11 +34,11 @@ class TestWizardPrintRecordLabel(TransactionCase):
) )
def test_create_action(self): def test_create_action(self):
""" Check the creation of action """ """Check the creation of action"""
self.label.create_action() self.label.create_action()
self.assertTrue(self.label.action_window_id) self.assertTrue(self.label.action_window_id)
def test_unlink_action(self): def test_unlink_action(self):
""" Check the unlink of action """ """Check the unlink of action"""
self.label.unlink_action() self.label.unlink_action()
self.assertFalse(self.label.action_window_id) self.assertFalse(self.label.action_window_id)

View File

@@ -58,20 +58,20 @@ class TestPrintingLabelZpl2(TransactionCase):
return self.ComponentModel.create(values) return self.ComponentModel.create(values)
def test_print_on_bad_model(self): def test_print_on_bad_model(self):
""" Check that printing on the bad model raises an exception """ """Check that printing on the bad model raises an exception"""
label = self.new_label() label = self.new_label()
with self.assertRaises(exceptions.UserError): with self.assertRaises(exceptions.UserError):
label.print_label(self.printer, label) label.print_label(self.printer, label)
@mock.patch("%s.cups" % model) @mock.patch("%s.cups" % model)
def test_print_empty_label(self, cups): def test_print_empty_label(self, cups):
""" Check that printing an empty label works """ """Check that printing an empty label works"""
label = self.new_label() label = self.new_label()
label.print_label(self.printer, self.printer) label.print_label(self.printer, self.printer)
cups.Connection().printFile.assert_called_once() cups.Connection().printFile.assert_called_once()
def test_empty_label_contents(self): def test_empty_label_contents(self):
""" Check contents of an empty label """ """Check contents of an empty label"""
label = self.new_label() label = self.new_label()
contents = label._generate_zpl2_data(self.printer).decode("utf-8") contents = label._generate_zpl2_data(self.printer).decode("utf-8")
self.assertEqual( self.assertEqual(
@@ -91,7 +91,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_sublabel_label_contents(self): def test_sublabel_label_contents(self):
""" Check contents of a sublabel label component """ """Check contents of a sublabel label component"""
sublabel = self.new_label({"name": "Sublabel"}) sublabel = self.new_label({"name": "Sublabel"})
data = "Some text" data = "Some text"
self.new_component({"label_id": sublabel.id, "data": '"' + data + '"'}) self.new_component({"label_id": sublabel.id, "data": '"' + data + '"'})
@@ -309,7 +309,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_repeatable_sublabel_contents(self): def test_repeatable_sublabel_contents(self):
""" Check contents of a repeatable sublabel label component """ """Check contents of a repeatable sublabel label component"""
sublabel = self.new_label( sublabel = self.new_label(
{ {
"name": "Sublabel", "name": "Sublabel",
@@ -407,7 +407,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_text_label_contents(self): def test_text_label_contents(self):
""" Check contents of a text label """ """Check contents of a text label"""
label = self.new_label() label = self.new_label()
data = "Some text" data = "Some text"
self.new_component({"label_id": label.id, "data": '"%s"' % data}) self.new_component({"label_id": label.id, "data": '"%s"' % data})
@@ -437,7 +437,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_reversed_text_label_contents(self): def test_reversed_text_label_contents(self):
""" Check contents of a text label """ """Check contents of a text label"""
label = self.new_label() label = self.new_label()
data = "Some text" data = "Some text"
self.new_component( self.new_component(
@@ -471,7 +471,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_block_text_label_contents(self): def test_block_text_label_contents(self):
""" Check contents of a text label """ """Check contents of a text label"""
label = self.new_label() label = self.new_label()
data = "Some text" data = "Some text"
self.new_component( self.new_component(
@@ -505,7 +505,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_rectangle_label_contents(self): def test_rectangle_label_contents(self):
""" Check contents of a rectangle label """ """Check contents of a rectangle label"""
label = self.new_label() label = self.new_label()
self.new_component({"label_id": label.id, "component_type": "rectangle"}) self.new_component({"label_id": label.id, "component_type": "rectangle"})
contents = label._generate_zpl2_data(self.printer).decode("utf-8") contents = label._generate_zpl2_data(self.printer).decode("utf-8")
@@ -532,7 +532,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_diagonal_line_label_contents(self): def test_diagonal_line_label_contents(self):
""" Check contents of a diagonal line label """ """Check contents of a diagonal line label"""
label = self.new_label() label = self.new_label()
self.new_component({"label_id": label.id, "component_type": "diagonal"}) self.new_component({"label_id": label.id, "component_type": "diagonal"})
contents = label._generate_zpl2_data(self.printer).decode("utf-8") contents = label._generate_zpl2_data(self.printer).decode("utf-8")
@@ -559,7 +559,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_circle_label_contents(self): def test_circle_label_contents(self):
""" Check contents of a circle label """ """Check contents of a circle label"""
label = self.new_label() label = self.new_label()
self.new_component({"label_id": label.id, "component_type": "circle"}) self.new_component({"label_id": label.id, "component_type": "circle"})
contents = label._generate_zpl2_data(self.printer).decode("utf-8") contents = label._generate_zpl2_data(self.printer).decode("utf-8")
@@ -586,7 +586,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_code11_barcode_label_contents(self): def test_code11_barcode_label_contents(self):
""" Check contents of a code 11 barcode label """ """Check contents of a code 11 barcode label"""
label = self.new_label() label = self.new_label()
data = "Some text" data = "Some text"
self.new_component( self.new_component(
@@ -624,7 +624,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_2of5_barcode_label_contents(self): def test_2of5_barcode_label_contents(self):
""" Check contents of a interleaved 2 of 5 barcode label """ """Check contents of a interleaved 2 of 5 barcode label"""
label = self.new_label() label = self.new_label()
data = "Some text" data = "Some text"
self.new_component( self.new_component(
@@ -662,7 +662,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_code39_barcode_label_contents(self): def test_code39_barcode_label_contents(self):
""" Check contents of a code 39 barcode label """ """Check contents of a code 39 barcode label"""
label = self.new_label() label = self.new_label()
data = "Some text" data = "Some text"
self.new_component( self.new_component(
@@ -700,7 +700,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_code49_barcode_label_contents(self): def test_code49_barcode_label_contents(self):
""" Check contents of a code 49 barcode label """ """Check contents of a code 49 barcode label"""
label = self.new_label() label = self.new_label()
data = "Some text" data = "Some text"
self.new_component( self.new_component(
@@ -738,7 +738,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_code49_barcode_label_contents_line(self): def test_code49_barcode_label_contents_line(self):
""" Check contents of a code 49 barcode label """ """Check contents of a code 49 barcode label"""
label = self.new_label() label = self.new_label()
data = "Some text" data = "Some text"
self.new_component( self.new_component(
@@ -819,7 +819,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_pdf417_barcode_label_contents(self): def test_pdf417_barcode_label_contents(self):
""" Check contents of a pdf417 barcode label """ """Check contents of a pdf417 barcode label"""
label = self.new_label() label = self.new_label()
data = "Some text" data = "Some text"
self.new_component( self.new_component(
@@ -853,7 +853,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_ean8_barcode_label_contents(self): def test_ean8_barcode_label_contents(self):
""" Check contents of a ean-8 barcode label """ """Check contents of a ean-8 barcode label"""
label = self.new_label() label = self.new_label()
data = "Some text" data = "Some text"
self.new_component( self.new_component(
@@ -887,7 +887,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_upce_barcode_label_contents(self): def test_upce_barcode_label_contents(self):
""" Check contents of a upc-e barcode label """ """Check contents of a upc-e barcode label"""
label = self.new_label() label = self.new_label()
data = "Some text" data = "Some text"
self.new_component( self.new_component(
@@ -921,7 +921,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_code128_barcode_label_contents(self): def test_code128_barcode_label_contents(self):
""" Check contents of a code 128 barcode label """ """Check contents of a code 128 barcode label"""
label = self.new_label() label = self.new_label()
data = "Some text" data = "Some text"
self.new_component( self.new_component(
@@ -959,7 +959,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_ean13_barcode_label_contents(self): def test_ean13_barcode_label_contents(self):
""" Check contents of a ean-13 barcode label """ """Check contents of a ean-13 barcode label"""
label = self.new_label() label = self.new_label()
data = "Some text" data = "Some text"
self.new_component( self.new_component(
@@ -993,7 +993,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_qrcode_barcode_label_contents(self): def test_qrcode_barcode_label_contents(self):
""" Check contents of a qr code barcode label """ """Check contents of a qr code barcode label"""
label = self.new_label() label = self.new_label()
data = "Some text" data = "Some text"
self.new_component( self.new_component(
@@ -1031,7 +1031,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_graphic_label_contents_blank(self): def test_graphic_label_contents_blank(self):
""" Check contents of a image label """ """Check contents of a image label"""
label = self.new_label() label = self.new_label()
data = "R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" data = "R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="
self.new_component( self.new_component(
@@ -1054,7 +1054,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_graphic_label_contents_blank_rotated(self): def test_graphic_label_contents_blank_rotated(self):
""" Check contents of image rotated label """ """Check contents of image rotated label"""
label = self.new_label() label = self.new_label()
data = "R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" data = "R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="
self.new_component( self.new_component(
@@ -1082,7 +1082,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_graphic_label_contents_blank_inverted(self): def test_graphic_label_contents_blank_inverted(self):
""" Check contents of a image inverted label """ """Check contents of a image inverted label"""
label = self.new_label() label = self.new_label()
data = "R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" data = "R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="
self.new_component( self.new_component(
@@ -1106,7 +1106,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_graphic_label_contents_blank_bottom(self): def test_graphic_label_contents_blank_bottom(self):
""" Check contents of a image bottom label """ """Check contents of a image bottom label"""
label = self.new_label() label = self.new_label()
data = "R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" data = "R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="
self.new_component( self.new_component(
@@ -1130,7 +1130,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_zpl2_raw_contents_blank(self): def test_zpl2_raw_contents_blank(self):
""" Check contents of a image label """ """Check contents of a image label"""
label = self.new_label() label = self.new_label()
data = "^FO50,50^GB100,100,100^FS" data = "^FO50,50^GB100,100,100^FS"
self.new_component( self.new_component(
@@ -1153,7 +1153,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_zpl2_component_not_show(self): def test_zpl2_component_not_show(self):
""" Check to don't show no things """ """Check to don't show no things"""
label = self.new_label() label = self.new_label()
data = "component_not_show" data = "component_not_show"
self.new_component( self.new_component(
@@ -1169,7 +1169,7 @@ class TestPrintingLabelZpl2(TransactionCase):
) )
def test_zpl2_component_quick_move(self): def test_zpl2_component_quick_move(self):
""" Check component quick move """ """Check component quick move"""
label = self.new_label() label = self.new_label()
component = self.new_component( component = self.new_component(
{ {

View File

@@ -35,7 +35,7 @@ class TestWizardPrintRecordLabel(TransactionCase):
) )
def test_get_record(self): def test_get_record(self):
""" Check if return a record """ """Check if return a record"""
self.label.record_id = 10 self.label.record_id = 10
res = self.label._get_record() res = self.label._get_record()
@@ -47,7 +47,7 @@ class TestWizardPrintRecordLabel(TransactionCase):
@mock.patch("%s.cups" % model) @mock.patch("%s.cups" % model)
def test_print_label_test(self, cups): def test_print_label_test(self, cups):
""" Check if print test """ """Check if print test"""
self.label.test_print_mode = True self.label.test_print_mode = True
self.label.printer_id = self.printer self.label.printer_id = self.printer
self.label.record_id = 10 self.label.record_id = 10
@@ -55,12 +55,12 @@ class TestWizardPrintRecordLabel(TransactionCase):
cups.Connection().printFile.assert_called_once() cups.Connection().printFile.assert_called_once()
def test_emulation_without_params(self): def test_emulation_without_params(self):
""" Check if not execute next if not in this mode """ """Check if not execute next if not in this mode"""
self.label.test_labelary_mode = False self.label.test_labelary_mode = False
self.assertIs(self.label.labelary_image, False) self.assertIs(self.label.labelary_image, False)
def test_emulation_with_bad_header(self): def test_emulation_with_bad_header(self):
""" Check if bad header """ """Check if bad header"""
self.label.test_labelary_mode = True self.label.test_labelary_mode = True
self.label.labelary_width = 80 self.label.labelary_width = 80
self.label.labelary_dpmm = "8dpmm" self.label.labelary_dpmm = "8dpmm"
@@ -71,7 +71,7 @@ class TestWizardPrintRecordLabel(TransactionCase):
self.assertFalse(self.label.labelary_image) self.assertFalse(self.label.labelary_image)
def test_emulation_with_bad_data_compute(self): def test_emulation_with_bad_data_compute(self):
""" Check if bad data compute """ """Check if bad data compute"""
self.label.test_labelary_mode = True self.label.test_labelary_mode = True
self.label.labelary_width = 80 self.label.labelary_width = 80
self.label.labelary_height = 30 self.label.labelary_height = 30
@@ -83,7 +83,7 @@ class TestWizardPrintRecordLabel(TransactionCase):
self.assertIs(self.label.labelary_image, False) self.assertIs(self.label.labelary_image, False)
def test_emulation_with_good_data(self): def test_emulation_with_good_data(self):
""" Check if ok """ """Check if ok"""
self.label.test_labelary_mode = True self.label.test_labelary_mode = True
self.label.labelary_width = 80 self.label.labelary_width = 80
self.label.labelary_height = 30 self.label.labelary_height = 30

View File

@@ -32,12 +32,12 @@ class TestWizardImportZpl2(TransactionCase):
) )
def test_open_wizard(self): def test_open_wizard(self):
""" open wizard from label""" """open wizard from label"""
res = self.label.import_zpl2() res = self.label.import_zpl2()
self.assertEqual(res.get("context").get("default_label_id"), self.label.id) self.assertEqual(res.get("context").get("default_label_id"), self.label.id)
def test_wizard_import_zpl2(self): def test_wizard_import_zpl2(self):
""" Import ZPL2 from wizard """ """Import ZPL2 from wizard"""
zpl_data = ( zpl_data = (
"^XA\n" "^XA\n"
"^CI28\n" "^CI28\n"
@@ -76,7 +76,7 @@ class TestWizardImportZpl2(TransactionCase):
self.assertEqual(18, len(self.label.component_ids)) self.assertEqual(18, len(self.label.component_ids))
def test_wizard_import_zpl2_add(self): def test_wizard_import_zpl2_add(self):
""" Import ZPL2 from wizard ADD""" """Import ZPL2 from wizard ADD"""
self.env["printing.label.zpl2.component"].create( self.env["printing.label.zpl2.component"].create(
{ {
"name": "ZPL II Label", "name": "ZPL II Label",

View File

@@ -37,7 +37,7 @@ class TestWizardPrintRecordLabel(TransactionCase):
@mock.patch("%s.cups" % model) @mock.patch("%s.cups" % model)
def test_print_record_label(self, cups): def test_print_record_label(self, cups):
""" Check that printing a label using the generic wizard works """ """Check that printing a label using the generic wizard works"""
wizard_obj = self.Model.with_context( wizard_obj = self.Model.with_context(
active_model="printing.printer", active_model="printing.printer",
active_id=self.printer.id, active_id=self.printer.id,

View File

@@ -51,7 +51,7 @@ class PrintRecordLabel(models.TransientModel):
return values return values
def print_label(self): def print_label(self):
""" Prints a label per selected record """ """Prints a label per selected record"""
record_model = self.env.context["active_model"] record_model = self.env.context["active_model"]
for record_id in self.env.context["active_ids"]: for record_id in self.env.context["active_ids"]:
record = self.env[record_model].browse(record_id) record = self.env[record_model].browse(record_id)