示例#1
0
 def test_error_empty_queue(self):
     # Cola vacia
     # Testeo de Error de cola
     impresion = Printer()
     impresion.print_job()
     self.assertTrue(impresion.error_flag)
     self.assertEqual(impresion.error_description, "nothing to print")
示例#2
0
 def test_impresion_ok_simple(self):
     # Impresion ok de 1 item
     # Testeo
     impresion = Printer()
     impresion.add_print_job("Python")
     impresion.print_job()
     # Termina la impresion
     impresion.reset_printer()
     self.assertTrue(impresion.printer_available())
示例#3
0
 def test_printer_avialable(self):
     impresora = Printer()
     printer_ok = impresora.printer_available
     self.assertTrue(printer_ok)
示例#4
0
 def test_reset_printer(self):
     impresora = Printer()
     impresora.reset_printer()
     self.assertFalse(impresora.printing)
示例#5
0
 def test_print_job2(self):
     impresora = Printer()
     impresora.print_job()
     self.assertTrue(impresora.error_flag)
示例#6
0
 def test_print_job(self):
     impresora = Printer()
     printer_ok = impresora.print_job
     self.assertTrue(printer_ok)
示例#7
0
 def setUp(self):
     self.printer = Printer()
示例#8
0
class TestPrinter(unittest.TestCase):
    def setUp(self):
        self.printer = Printer()

    def test_nada_para_imprimir(self):
        self.printer.print_job()
        self.assertTrue(self.printer.error_flag)
        self.assertEqual(self.printer.error_description, 'nothing to print')

    def test_impresora_no_disponible(self):
        self.printer.add_print_job("Juan")
        self.printer.add_print_job("Pepe")
        self.printer.add_print_job("Paco")
        self.printer.print_job()
        self.assertFalse(self.printer.printer_available())

    def test_imprime_con_normalidad(self):
        self.assertTrue(self.printer.printer_available())
        self.printer.add_print_job("Estocolmo")
        self.printer.print_job()
        self.assertTrue(self.printer.printing)
        self.printer.reset_printer()
        self.assertTrue(self.printer.printer_available())
示例#9
0
 def test_reseteo(self):
     # Test de reset_printer
     impresion = Printer()
     # Genero error para modificar error_flag y error_description
     impresion.print_job()
     impresion.add_print_job("Python")
     impresion.add_print_job("Python2")
     impresion.add_print_job("Python3")
     impresion.print_job()
     impresion.reset_printer()
     impresion.print_job()
     impresion.reset_printer()
     impresion.print_job()
     impresion.reset_printer()
     self.assertTrue(impresion.printer_available())
     self.assertFalse(impresion.error_flag)
     self.assertEqual(impresion.error_description, "")
示例#10
0
 def test_estado_inicial_impresora(self):
     impresion = Printer()
     self.assertTrue(impresion.printer_available())
     self.assertFalse(impresion.error_flag)
     self.assertEqual(impresion.error_description, "")
示例#11
0
 def test_printer_unavailable(self):
     impresion = Printer()
     impresion.add_print_job("Python")
     impresion.print_job()
     self.assertFalse(impresion.printer_available())
示例#12
0
 def test_impresion_ok_multiple(self):
     # Impresion ok de varios items
     # Testeo General
     impresion = Printer()
     impresion.add_print_job("Hey")
     impresion.add_print_job("Vsauce")
     impresion.add_print_job("Michael")
     impresion.add_print_job("here")
     impresion.print_job()
     impresion.reset_printer()
     impresion.print_job()
     impresion.reset_printer()
     impresion.print_job()
     impresion.reset_printer()
     impresion.print_job()
     # Termina la impresion
     impresion.reset_printer()
     self.assertTrue(impresion.printer_available())
示例#13
0
class TestPrinter(unittest.TestCase):
    def setUp(self):
        self.printer = Printer()

    def test_printer_ok(self):
        self.assertTrue(self.printer.printer_available)
        self.printer.add_print_job('Test de Impresion')
        self.printer.add_print_job('Hola')
        self.printer.add_print_job('12345678')
        self.assertTrue(self.printer.print_job)

    def test_printer_nothing_print(self):
        self.printer.print_job()
        self.assertTrue(self.printer.error_flag)
        self.assertEqual(self.printer.error_description,"nothing to print")
        self.assertFalse(self.printer.printing)

    def test_printer_not_available(self):
        self.printer.add_print_job('Test de Impresion')
        self.printer.add_print_job('Hola')
        self.printer.add_print_job('12345678')
        self.printer.print_job()
        self.assertFalse(self.printer.printer_available())

    def test_print_queue(self):
        self.printer.add_print_job('Hola')
        self.assertTrue(self.printer.printer_available())
        self.printer.add_print_job('12345678')
        self.printer.add_print_job('asdasdasd')
        self.printer.add_print_job('qwerty')
        self.printer.print_job()
        self.assertFalse(self.printer.printer_available())