def test_bad_trace(self): check = CheckNTPMon() self.assertEqual(check.trace(''), 1, 'Invalid trace not detected') self.assertEqual(check.trace(' '), 1, 'Invalid trace not detected') self.assertEqual(check.trace('!@#$%^&*()'), 1, 'Invalid trace not detected') self.assertEqual(check.trace('blah.example.com'), 1, 'Invalid trace not detected')
def test_bad_trace_demos(self): """Ensure that bad demo traces produce errors.""" check = CheckNTPMon() # for d in demodata: # self.assertEqual(check.trace(d.split("\n")), 2, 'Demo data not detected as bad trace') for d in baddemotrace: self.assertEqual(check.trace(d.split("\n")), 2, 'Invalid trace not detected')
def test_trace_demos(self): """Ensure that demo traces are parsed successfully and don't produce exceptions or unknown results.""" for d in demotrace: check = CheckNTPMon() self.assertEqual(check.trace(d.split("\n")), 0, 'Error parsing demo trace data')