@@ -59,6 +59,8 @@ async def log_requests(request: Request, call_next):
5959 "created_at" : datetime .datetime .now ().isoformat (),
6060 "next_run_at" : None ,
6161 "health_status" : "healthy" ,
62+ "pending_timeout" : 300 ,
63+ "running_timeout" : 0 ,
6264 "run_results" : {
6365 "cancelled" : 0 ,
6466 "crashed" : 0 ,
@@ -83,13 +85,16 @@ def now_iso():
8385
8486
8587def create_schedule_object (
86- schedule_id , app_name , cron , environment = "default" , parameters = None
88+ schedule_id , app_name , cron , environment = "default" , parameters = None , name = None
8789):
8890 return {
8991 "id" : schedule_id ,
92+ "name" : name or f"{ app_name } -schedule" ,
9093 "app_name" : app_name ,
94+ "app_status" : "active" ,
9195 "cron" : cron ,
9296 "environment" : environment ,
97+ "overlap_policy" : "skip" ,
9398 "status" : "active" ,
9499 "created_at" : now_iso (),
95100 "updated_at" : now_iso (),
@@ -143,6 +148,8 @@ async def create_app(app_data: Dict[str, Any]):
143148 "name" : app_name ,
144149 "next_run_at" : None ,
145150 "owner" : "mock_owner" ,
151+ "pending_timeout" : 300 ,
152+ "running_timeout" : 0 ,
146153 "run_results" : {
147154 "cancelled" : 0 ,
148155 "crashed" : 0 ,
@@ -222,7 +229,7 @@ async def deploy_app(name: str, response: Response):
222229 return {"version" : deployed_version }
223230
224231
225- @app .post ("/v1/apps/{name}/runs" )
232+ @app .post ("/v1/apps/{name}/runs" , status_code = 201 )
226233async def run_app (name : str , run_params : Dict [str , Any ]):
227234 if name not in mock_apps_db :
228235 raise HTTPException (status_code = 404 , detail = f"App '{ name } ' not found" )
@@ -273,6 +280,7 @@ async def run_app(name: str, run_params: Dict[str, Any]):
273280 "is_scheduled" : True ,
274281 "initiator" : {
275282 "type" : "tower_cli" ,
283+ "details" : {},
276284 },
277285 }
278286 mock_runs_db [run_id ] = new_run
@@ -474,6 +482,7 @@ async def get_session():
474482 "is_subscribed_to_changelog" : False ,
475483 "last_name" : "User" ,
476484 "profile_photo_url" : "https://example.com/photo.jpg" ,
485+ "promo_code" : "" ,
477486 },
478487 "teams" : [
479488 {"name" : "default" , "type" : "user" , "token" : {"jwt" : "mock_jwt_token" }}
@@ -604,7 +613,7 @@ async def list_schedules():
604613 }
605614
606615
607- @app .post ("/v1/schedules" )
616+ @app .post ("/v1/schedules" , status_code = 201 )
608617async def create_schedule (schedule_data : Dict [str , Any ]):
609618 """Mock endpoint for creating a schedule."""
610619 app_name = schedule_data .get ("app_name" )
@@ -624,15 +633,15 @@ async def create_schedule(schedule_data: Dict[str, Any]):
624633 return {"schedule" : new_schedule }
625634
626635
627- @app .put ("/v1/schedules/{schedule_id }" )
628- async def update_schedule (schedule_id : str , schedule_data : Dict [str , Any ]):
636+ @app .put ("/v1/schedules/{id_or_name }" )
637+ async def update_schedule (id_or_name : str , schedule_data : Dict [str , Any ]):
629638 """Mock endpoint for updating a schedule."""
630- if schedule_id not in mock_schedules_db :
639+ if id_or_name not in mock_schedules_db :
631640 raise HTTPException (
632- status_code = 404 , detail = f"Schedule '{ schedule_id } ' not found"
641+ status_code = 404 , detail = f"Schedule '{ id_or_name } ' not found"
633642 )
634643
635- schedule = mock_schedules_db [schedule_id ]
644+ schedule = mock_schedules_db [id_or_name ]
636645 if "cron" in schedule_data :
637646 schedule ["cron" ] = schedule_data ["cron" ]
638647 if "parameters" in schedule_data :
0 commit comments