def test_result(self): sla1 = base.IterationTime(42) sla2 = base.IterationTime(3.62) for sla in [sla1, sla2]: sla.add_iteration({"duration": 3.14}) sla.add_iteration({"duration": 6.28}) self.assertTrue(sla1.result()["success"]) # 42 > 6.28 self.assertFalse(sla2.result()["success"]) # 3.62 < 6.28 self.assertEqual("Passed", sla1.status()) self.assertEqual("Failed", sla2.status())
def test_add_iteration(self): sla = base.IterationTime(4.0) self.assertTrue(sla.add_iteration({"duration": 3.14})) self.assertTrue(sla.add_iteration({"duration": 2.0})) self.assertTrue(sla.add_iteration({"duration": 3.99})) self.assertFalse(sla.add_iteration({"duration": 4.5})) self.assertFalse(sla.add_iteration({"duration": 3.8}))
def test_result_no_iterations(self): sla = base.IterationTime(42) self.assertTrue(sla.result()["success"])