def test_finish_run(self): manager = StatusManager("TestBot") manager.finish_run() last_item = StatusManager("TestBot").last_run compare(True, last_item.finish) self.assertGreater(last_item.finish_time, datetime.min) self.assertGreater(last_item.finish_time, last_item.start_time)
def test_finish_success(self): manager = StatusManager("TestBot") manager.current_run.success = True manager.finish_run() last_item = StatusManager("TestBot").last_run compare(True, last_item.success) manager2 = StatusManager("TestBot") manager2.finish_run(success=True) last_item = StatusManager("TestBot").last_run compare(True, last_item.success)
def test_get_last_finished_runs(self): manager = StatusManager("TestBot") manager.finish_run() StatusManager("TestBot") manager = StatusManager("TestBot") manager.finish_run(success=True) status_manager_last_runs = StatusManager("TestBot") compare(2, len(status_manager_last_runs.last_finished_runs)) # newest entry first in array compare(datetime(year=2001, month=1, day=1, minute=6), status_manager_last_runs.last_finished_runs[0].start_time) compare(datetime(year=2001, month=1, day=1, minute=0), status_manager_last_runs.last_finished_runs[1].start_time)
def test_finish_no_success(self): manager = StatusManager("TestBot") manager.finish_run() last_item = StatusManager("TestBot").last_run compare(False, last_item.success)