def test_success(self): arm_info = haplib.ArmInfo() time0 = float(hapcommon.get_current_hatohol_time()) arm_info.success() time1 = float(hapcommon.get_current_hatohol_time()) self.assertEquals(arm_info.last_status, "OK") self.assertEquals(arm_info.num_success, 1) arm_info_time = float(arm_info.last_success_time) self.assertGreaterEqual(arm_info_time, time0) self.assertGreaterEqual(time1, arm_info_time)
def test_fail(self): arm_info = haplib.ArmInfo() time0 = float(hapcommon.get_current_hatohol_time()) arm_info.fail("Reason") time1 = float(hapcommon.get_current_hatohol_time()) self.assertEquals(arm_info.last_status, "NG") self.assertEquals(arm_info.failure_reason, "Reason") self.assertEquals(arm_info.num_failure, 1) arm_info_time = float(arm_info.last_failure_time) self.assertGreaterEqual(arm_info_time, time0) self.assertGreaterEqual(time1, arm_info_time)
def fail(self, reason="", status="NG"): self.last_status = status self.last_failure_time = hapcommon.get_current_hatohol_time() self.num_failure += 1 self.failure_reason = reason
def success(self, status="OK"): self.last_status = status self.last_success_time = hapcommon.get_current_hatohol_time() self.num_success += 1
def test_get_current_hatohol_time(self): result = hapcommon.get_current_hatohol_time() self.assertTrue(14 < len(result) < 22) ns = int(result[15:21]) self.assertTrue(0 <= ns < 1000000)
def test_get_current_hatohol_time(self): result = hapcommon.get_current_hatohol_time() self.assertTrue(14 < len(result) < 22) ns = int(result[15: 21]) self.assertTrue(0 <= ns < 1000000)