def test_stop_on_fail(self): with self.assertRaises(SystemExit): dw.commandline_check_csv(self.dfile2, self.yfile1, False) self.assertEqual( self.capturedStout.getvalue(), 'want row count == 5, got 8\n')
def test_yamlerror(self): with self.assertRaises(SystemExit) as e: dw.commandline_check_csv(self.dfile1, self.yfile3, True) self.assertEqual(e.exception.code, 5)
def test_all_failed(self): with self.assertRaises(SystemExit) as e: dw.commandline_check_csv(self.dfile2, self.yfile1a, True) self.assertEqual(e.exception.code, 1) self.assertEqual(self.capturedStout.getvalue(), _ALL_FAILED)
def test_allpassed_verbose(self): dw.commandline_check_csv(self.dfile1, self.yfile1, True) self.assertEqual(self.capturedStout.getvalue(), _ALL_PASSED)
def test_yamlfile_not_found(self): with self.assertRaises(SystemExit) as e: dw.commandline_check_csv(self.dfile1, self.yfilez, True) self.assertEqual(e.exception.code, 4)
def test_allpassed_silent(self): dw.commandline_check_csv(self.dfile1, self.yfile1, False) self.assertEqual(self.capturedStout.getvalue(), '')
def test_yamlerror(self): with self.assertRaises(SystemExit) as e: dw.commandline_check_csv('data/file1.csv', 'yamls/file3.yaml', True) self.assertEqual(e.exception.code, 5)
def test_yamlfile_not_found(self): with self.assertRaises(SystemExit) as e: dw.commandline_check_csv('data/file1.csv', 'yamls/zile1.yaml', True) self.assertEqual(e.exception.code, 4)
def test_allpassed_verbose(self): dw.commandline_check_csv('data/file1.csv', 'yamls/file1.yaml', True) self.assertEqual(self.capturedStout.getvalue(), _ALL_PASSED)
def test_allpassed_silent(self): dw.commandline_check_csv('data/file1.csv', 'yamls/file1.yaml', False) self.assertEqual(self.capturedStout.getvalue(), '')