def test_step5_module_banking_recon_fvb(self): import banking.fvb.reconciliation with captured_output() as (out, err): banking.fvb.reconciliation.do_reconciliation() output = out.getvalue().strip() self.assertEqual('Doing First Virtual Bank reconciliation.', output)
def test_step4_module_journal_output(self): with captured_output() as (out, err): import transactions.journal importlib.reload(transactions.journal) output = out.getvalue().strip() self.assertTrue(output.find('[Module] Journal loaded.') > -1)
def test_step5_module_banking_output(self): with captured_output() as (out, err): import banking.reconciliation importlib.reload(banking.reconciliation) output = out.getvalue().strip() self.assertTrue(output.find('[Module] Reconciliation loaded.') > -1)
def test_step7_module_banking_recon_online(self): import banking.online.reconciliation with captured_output() as (out, err): banking.online.reconciliation.do_reconciliation() output = out.getvalue().strip() self.assertEqual('Doing Online Bank reconciliation.\n200', output)
def test_step3_user_auth(self): import user.authentication with captured_output() as (out, err): user.authentication.authenticate_user() output = out.getvalue().strip() self.assertEqual('Authenticating User', output)
def test_step5_module_banking_recon_ubsa(self): import banking.ubsa.reconciliation with captured_output() as (out, err): banking.ubsa.reconciliation.do_reconciliation() output = out.getvalue().strip() self.assertEqual('Doing Unreal Bank of South Africa reconciliation.', output)
def test_step4_module_journal_use(self): import transactions.journal as journal with captured_output() as (out, err): journal.receive_income(100) journal.pay_expense(100) output = out.getvalue().strip() self.assertEqual('[Journal] Received R100.00\n[Journal] Paid R100.00', output)
def test_step2_module_auth_output(self): with captured_output() as (out, err): import user.authentication importlib.reload(user.authentication) output = out.getvalue().strip() self.assertTrue(output.find('[Module] User Authentication loaded.') > -1)
def test_correct(self): with captured_output() as (out, err): robot.move() output = out.getvalue().strip() file = open('tests/test_output.txt', 'r') expectedOutput = file.read() self.assertEqual(expectedOutput, output)
def test_step3(self): with captured_output() as (out, err): course.create_outline() output = out.getvalue().strip() self.assertTrue('Student Progress:' in output) self.assertTrue('1.' in output) self.assertTrue('2.' in output) self.assertTrue('[GRADED]' in output) self.assertTrue('[STARTED]' in output) self.assertTrue('[COMPLETED]' in output)
def test_step1(self): with captured_output() as (out, err): course.create_outline() output = out.getvalue().strip() self.assertEqual("Course Topics:\n*", output[:16]) self.assertTrue('* Introduction to Python' in output) self.assertTrue('* Tools of the Trade' in output) self.assertTrue('* How to make decisions' in output) self.assertTrue('* How to repeat code' in output) self.assertTrue('* How to structure data' in output) self.assertTrue('* Functions' in output) self.assertTrue('* Modules' in output)
def test_step4(self): with captured_output() as (out, err): course.create_outline() output = out.getvalue().strip() self.assertEqual( """Course Topics: * Functions * How to make decisions * How to repeat code * How to structure data * Introduction to Python * Modules * Tools of the Trade""", output[:151]) self.assertTrue(output.index('COMPLETED') > output.index('GRADED')) self.assertTrue(output.index('GRADED') > output.index('STARTED'))
def test_step2(self): with captured_output() as (out, err): course.create_outline() output = out.getvalue().strip() self.assertTrue('Problems:' in output) self.assertTrue( '* Introduction to Python : Problem 1, Problem 2, Problem 3' in output) self.assertTrue( '* Tools of the Trade : Problem 1, Problem 2, Problem 3' in output) self.assertTrue( '* How to make decisions : Problem 1, Problem 2, Problem 3' in output) self.assertTrue( '* How to repeat code : Problem 1, Problem 2, Problem 3' in output) self.assertTrue( '* How to structure data : Problem 1, Problem 2, Problem 3' in output) self.assertTrue( '* Functions : Problem 1, Problem 2, Problem 3' in output) self.assertTrue( '* Modules : Problem 1, Problem 2, Problem 3' in output)
def test_step1(self): with captured_output() as (out, err): hello.print_hello() # This can go inside or outside the `with` block output = out.getvalue().strip() self.assertEqual(output, "Hello World!")