Ejemplo n.º 1
0
 def test_label_printer1(self):
     """Assert can determine the label printer if have a default printer."""
     label = Label()
     label.zpl_template = self.zpl_template
     label.default_label_printer = self.label_printer_default
     self.assertIsNotNone(label.label_printer)
     self.assertEquals(label.label_printer.cups_server_ip, '127.0.0.1')
Ejemplo n.º 2
0
 def test_label_printer4c(self):
     """Assert for a given client address, picks the default (of 2 printers) for the client event though there is a general overall default printer."""
     label = Label()
     label.zpl_template = self.zpl_template
     label.client_addr = '127.0.0.11'
     label.default_label_printer = self.label_printer_default
     self.assertTrue(label.label_printer == self.label_printer_client_11_default)
Ejemplo n.º 3
0
 def test_label_printer4b(self):
     """Assert for a given client address, picks the overall default label printer if there is no printer defined for the client."""
     label = Label()
     label.zpl_template = self.zpl_template
     label.client_addr = '127.0.0.13'
     label.default_label_printer = self.label_printer_default
     self.assertEqual(label.label_printer, self.label_printer_default)
Ejemplo n.º 4
0
 def test_label_printer1(self):
     """Assert can determine the label printer if have a default printer."""
     label = Label()
     label.zpl_template = self.zpl_template
     label.default_label_printer = self.label_printer_default
     self.assertIsNotNone(label.label_printer)
     self.assertEquals(label.label_printer.cups_server_ip, '127.0.0.1')
Ejemplo n.º 5
0
 def test_label_printer5(self):
     """Assert for a given client address, can determine the assigned label printer."""
     label = Label()
     label.zpl_template = self.zpl_template
     label.client_addr = '127.0.0.10'
     label.default_label_printer = self.label_printer_default
     self.assertTrue(label.label_printer == self.label_printer_client_10)
Ejemplo n.º 6
0
 def test_label_printer5(self):
     """Assert for a given client address, can determine the assigned label printer."""
     label = Label()
     label.zpl_template = self.zpl_template
     label.client_addr = '127.0.0.10'
     label.default_label_printer = self.label_printer_default
     self.assertTrue(label.label_printer == self.label_printer_client_10)
Ejemplo n.º 7
0
 def test_label_printer4b(self):
     """Assert for a given client address, picks the overall default label printer if there is no printer defined for the client."""
     label = Label()
     label.zpl_template = self.zpl_template
     label.client_addr = '127.0.0.13'
     label.default_label_printer = self.label_printer_default
     self.assertEqual(label.label_printer, self.label_printer_default)
Ejemplo n.º 8
0
 def test_label_printer2(self):
     """Assert for a given client address, can determine the label printer if there is a default"""
     label = Label()
     label.zpl_template = self.zpl_template
     label.client_addr = '127.0.0.2'
     label.default_label_printer = self.label_printer_default
     self.assertTrue(label.label_printer, self.label_printer_default)
     self.assertFalse('Unable to determine the label printer for client {0}'.format(label.client_addr) in label.message)
Ejemplo n.º 9
0
 def test_label_printer4c(self):
     """Assert for a given client address, picks the default (of 2 printers) for the client event though there is a general overall default printer."""
     label = Label()
     label.zpl_template = self.zpl_template
     label.client_addr = '127.0.0.11'
     label.default_label_printer = self.label_printer_default
     self.assertTrue(
         label.label_printer == self.label_printer_client_11_default)
Ejemplo n.º 10
0
 def test_label_printer2(self):
     """Assert for a given client address, can determine the label printer if there is a default"""
     label = Label()
     label.zpl_template = self.zpl_template
     label.client_addr = '127.0.0.2'
     label.default_label_printer = self.label_printer_default
     self.assertTrue(label.label_printer, self.label_printer_default)
     self.assertFalse(
         'Unable to determine the label printer for client {0}'.format(
             label.client_addr) in label.message)
Ejemplo n.º 11
0
 def test_label_printer3b(self):
     """Assert for a given client address, does not picks localhost label printer if there is a default."""
     self.label_printer_default.default = False
     self.label_printer_default.save()
     self.label_printer_client_10.default = False
     self.label_printer_client_10.save()
     self.label_printer_client_11_default.default = False
     self.label_printer_client_11_default.save()
     label = Label()
     label.zpl_template = self.zpl_template
     label.client_addr = '127.0.0.2'
     label.default_label_printer = self.label_printer_client_11
     self.assertEquals(label.label_printer, self.label_printer_client_11)
Ejemplo n.º 12
0
 def test_label_printer3b(self):
     """Assert for a given client address, does not picks localhost label printer if there is a default."""
     self.label_printer_default.default = False
     self.label_printer_default.save()
     self.label_printer_client_10.default = False
     self.label_printer_client_10.save()
     self.label_printer_client_11_default.default = False
     self.label_printer_client_11_default.save()
     label = Label()
     label.zpl_template = self.zpl_template
     label.client_addr = '127.0.0.2'
     label.default_label_printer = self.label_printer_client_11
     self.assertEquals(label.label_printer, self.label_printer_client_11)
Ejemplo n.º 13
0
 def test_label_printer3(self):
     """Assert for a given client address, cannot determine the label printer if there isn't a default."""
     self.label_printer_default.default = False
     self.label_printer_default.cups_server_ip = '127.0.0.127'
     self.label_printer_default.save()
     self.label_printer_client_10.default = False
     self.label_printer_client_10.save()
     self.label_printer_client_11_default.default = False
     self.label_printer_client_11_default.save()
     label = Label()
     label.zpl_template = self.zpl_template
     label.client_addr = '127.0.0.2'
     label.default_label_printer = None
     self.assertIsNone(label.label_printer)
Ejemplo n.º 14
0
 def test_label_printer3(self):
     """Assert for a given client address, cannot determine the label printer if there isn't a default."""
     self.label_printer_default.default = False
     self.label_printer_default.cups_server_ip = '127.0.0.127'
     self.label_printer_default.save()
     self.label_printer_client_10.default = False
     self.label_printer_client_10.save()
     self.label_printer_client_11_default.default = False
     self.label_printer_client_11_default.save()
     label = Label()
     label.zpl_template = self.zpl_template
     label.client_addr = '127.0.0.2'
     label.default_label_printer = None
     self.assertIsNone(label.label_printer)
Ejemplo n.º 15
0
 def test_barcode_value(self):
     label = Label()
     label.zpl_template = self.zpl_template
     self.assertEqual(label.barcode_value, '123456789')
Ejemplo n.º 16
0
 def test_formatted_label(self):
     """Assert formatted label contains the barcode value."""
     label = Label()
     label.zpl_template = self.zpl_template
     self.assertIsNotNone(label.formatted_label_string)
     self.assertTrue(label.barcode_value in label.formatted_label_string)
Ejemplo n.º 17
0
 def test_template2(self):
     label = Label()
     label.zpl_template = self.zpl_template
     label.zpl_template_string = label.zpl_template.template
     self.assertIsNotNone(label.zpl_template_string)
Ejemplo n.º 18
0
 def test_write_print_file(self):
     """Assert can write label to a temp file."""
     label = Label()
     label.zpl_template = self.zpl_template
     self.assertTrue(label.write_formatted_label_to_file())
     self.assertTrue(os.path.isfile(label.file_name))
Ejemplo n.º 19
0
 def test_label_context(self):
     label = Label()
     label.zpl_template_string = self.default_zpl_template_string
     self.assertTrue('barcode_value' in label.label_context)
Ejemplo n.º 20
0
 def test_formatted_label(self):
     """Assert formatted label contains the barcode value."""
     label = Label()
     label.zpl_template = self.zpl_template
     self.assertIsNotNone(label.formatted_label_string)
     self.assertTrue(label.barcode_value in label.formatted_label_string)
Ejemplo n.º 21
0
 def test_barcode_value(self):
     label = Label()
     label.zpl_template = self.zpl_template
     self.assertEqual(label.barcode_value, '123456789')
Ejemplo n.º 22
0
 def test_label_context(self):
     label = Label()
     label.zpl_template_string = self.default_zpl_template_string
     self.assertTrue('barcode_value' in label.label_context)
Ejemplo n.º 23
0
 def test_write_print_file(self):
     """Assert can write label to a temp file."""
     label = Label()
     label.zpl_template = self.zpl_template
     self.assertTrue(label.write_formatted_label_to_file())
     self.assertTrue(os.path.isfile(label.file_name))
Ejemplo n.º 24
0
 def test_template2(self):
     label = Label()
     label.zpl_template = self.zpl_template
     label.zpl_template_string = label.zpl_template.template
     self.assertIsNotNone(label.zpl_template_string)