def test_should_i_run_custom_any(self): from core.Status import Status from core.TestType import TestType test_type = str(uuid.uuid4()) tt = TestType(test_type) tt.add_run_type('default', 'ANY', {'field': 'Status._status', 'operator': 'EQUAL', 'value': 'UNKNOWN'}) tt.save() test_id = str(uuid.uuid4()) test_status1 = 'FAILURE' details = {'browser': random.choice(['Firefox', 'Chrome'])} status1 = Status(test_id, test_type, test_status1, details=details) status1.save_and_update() res = Status(test_id).should_i_run() assert res == False test_id2 = str(uuid.uuid4()) test_status2 = 'SUCCESS' status2 = Status(test_id2, test_type, test_status2, details=details) status2.save_and_update() res = Status(test_id).should_i_run() assert res == False test_status3 = 'SUCCESS' status3 = Status(test_id, test_type, test_status3, details=details) status3.save_and_update() res = Status(test_id).should_i_run() assert res == False status4 = Status(str(uuid.uuid4())) status4.add_unknown_if_none_exist() res = status4.should_i_run() assert res == True
def run_get(test_id, run_type): status = StatusCore(test_id=test_id) status.add_unknown_if_none_exist() run = status.should_i_run(run_type) if run is None: abort(404) return run