def test_non_zero_exit_code(self): path = "/path" reason = "REASON" result = check.CheckResult(path, 1, reason, 0, 0) with self.assertRaises(exception.MiscFileReadException) as ctx: result.delay() self.assertIn(path, str(ctx.exception)) self.assertIn(reason, str(ctx.exception))
def test_check_result_non_zero_exit_code(): path = "/path" reason = "REASON" result = check.CheckResult(path, 1, reason, 0, 0) with pytest.raises(exception.MiscFileReadException) as ctx: result.delay() assert path in str(ctx.value) assert reason in str(ctx.value)
def test_unexpected_output(self, err): result = check.CheckResult("/path", 0, err, 0, 0) self.assertRaises(exception.MiscFileReadException, result.delay)
def test_success(self, err, seconds): result = check.CheckResult("/path", 0, err, 0, 0) self.assertEqual(result.delay(), seconds)
def test_unexpected_output(err): result = check.CheckResult("/path", 0, err, 0, 0) with pytest.raises(exception.MiscFileReadException): result.delay()
def test_check_result_success(err, seconds): result = check.CheckResult("/path", 0, err, 0, 0) assert result.delay() == seconds