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")
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())
def test_printer_avialable(self): impresora = Printer() printer_ok = impresora.printer_available self.assertTrue(printer_ok)
def test_reset_printer(self): impresora = Printer() impresora.reset_printer() self.assertFalse(impresora.printing)
def test_print_job2(self): impresora = Printer() impresora.print_job() self.assertTrue(impresora.error_flag)
def test_print_job(self): impresora = Printer() printer_ok = impresora.print_job self.assertTrue(printer_ok)
def setUp(self): self.printer = Printer()
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())
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, "")
def test_estado_inicial_impresora(self): impresion = Printer() self.assertTrue(impresion.printer_available()) self.assertFalse(impresion.error_flag) self.assertEqual(impresion.error_description, "")
def test_printer_unavailable(self): impresion = Printer() impresion.add_print_job("Python") impresion.print_job() self.assertFalse(impresion.printer_available())
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())
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())