def test_create_next_execute_item(): FlowItem.delete().where(FlowItem.name == FLOW_NAME).execute() worktime = pendulum.datetime(2020, 1, 1, tz="Europe/Moscow") interval_timedelta = dt.timedelta(1) item = FlowItem.create_next_execute_item( flow_name=FLOW_NAME, worktime=worktime, interval_timedelta=interval_timedelta, ) assert item is None FlowItem.create( **{ FlowItem.name.name: FLOW_NAME, FlowItem.worktime.name: worktime - dt.timedelta(1), } ) item = FlowItem.create_next_execute_item( flow_name=FLOW_NAME, worktime=worktime, interval_timedelta=interval_timedelta, ) assert item item = FlowItem.create_next_execute_item( flow_name=FLOW_NAME, worktime=worktime, interval_timedelta=interval_timedelta, ) assert item is None
def test_create_next_execute_item(flowitem_model): worktime = pendulum.datetime(2020, 1, 1, tz="Europe/Moscow") interval_timedelta = dt.timedelta(1) item = FlowItem.create_next_execute_item( flow_name=flowitem_model.name_for_test, worktime=worktime, interval_timedelta=interval_timedelta, ) assert item is None FlowItem.create( **{ FlowItem.name.name: flowitem_model.name_for_test, FlowItem.worktime.name: worktime - dt.timedelta(1), }) item = FlowItem.create_next_execute_item( flow_name=flowitem_model.name_for_test, worktime=worktime, interval_timedelta=interval_timedelta, ) assert item item = FlowItem.create_next_execute_item( flow_name=flowitem_model.name_for_test, worktime=worktime, interval_timedelta=interval_timedelta, ) assert item is None