File tree Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -229,7 +229,11 @@ def _configure_app(
229229
230230 progress .log (f"App created successfully! App slug: { app_data .slug } " )
231231
232- return write_app_config (path_to_deploy , slug = app_data .slug ), app_data
232+ app_config = AppConfig (app_id = app_data .id )
233+
234+ write_app_config (path_to_deploy , app_config )
235+
236+ return app_config , app_data
233237
234238
235239def _wait_for_deployment (
@@ -318,11 +322,11 @@ def deploy(
318322 toolkit , path_to_deploy = path_to_deploy
319323 )
320324 else :
321- toolkit .print (f "Deploying app [blue] { app_config . slug } [blue] ..." )
325+ toolkit .print ("Deploying app..." )
322326 toolkit .print_line ()
323327
324328 with toolkit .progress ("Checking app..." , transient = True ) as progress :
325- app_data = _get_app (app_config .slug )
329+ app_data = _get_app (app_config .app_id )
326330
327331 if not app_data :
328332 progress .set_error (
@@ -353,7 +357,7 @@ def deploy(
353357
354358 check_deployment_url = (
355359 settings .base_frontend_url
356- + f"/apps/{ app_config .slug } /deployments/{ deployment .id } "
360+ + f"/apps/{ app_data .slug } /deployments/{ deployment .id } "
357361 )
358362
359363 if not skip_wait :
Original file line number Diff line number Diff line change 55
66
77class AppConfig (BaseModel ):
8- slug : str
8+ app_id : str
99
1010
1111def get_app_config (path_to_deploy : Path ) -> Optional [AppConfig ]:
@@ -17,15 +17,11 @@ def get_app_config(path_to_deploy: Path) -> Optional[AppConfig]:
1717 return AppConfig .model_validate_json (config_path .read_text (encoding = "utf-8" ))
1818
1919
20- def write_app_config (path_to_deploy : Path , slug : str ) -> AppConfig :
20+ def write_app_config (path_to_deploy : Path , app_config : AppConfig ) -> None :
2121 config_path = path_to_deploy / ".fastapi/cloud.json"
2222 config_path .parent .mkdir (parents = True , exist_ok = True )
2323
24- app_config = AppConfig (slug = slug )
25-
2624 config_path .write_text (
2725 app_config .model_dump_json (),
2826 encoding = "utf-8" ,
2927 )
30-
31- return app_config
Original file line number Diff line number Diff line change @@ -346,9 +346,9 @@ def test_exists_successfully_when_deployment_is_done_when_app_is_configured(
346346 config_path = tmp_path / ".fastapi" / "cloud.json"
347347
348348 config_path .parent .mkdir (parents = True , exist_ok = True )
349- config_path .write_text ('{"slug ": "demo "}' )
349+ config_path .write_text ('{"app_id ": "1234 "}' )
350350
351- respx_mock .get ("/apps/demo " ).mock (
351+ respx_mock .get ("/apps/1234 " ).mock (
352352 return_value = Response (200 , json = {"slug" : "demo" , "id" : "1234" })
353353 )
354354
@@ -413,9 +413,9 @@ def test_shows_error_when_app_does_not_exist(
413413 config_path = tmp_path / ".fastapi" / "cloud.json"
414414
415415 config_path .parent .mkdir (parents = True , exist_ok = True )
416- config_path .write_text ('{"slug ": "demo "}' )
416+ config_path .write_text ('{"app_id ": "some-random-id "}' )
417417
418- respx_mock .get ("/apps/demo " ).mock (return_value = Response (404 ))
418+ respx_mock .get ("/apps/some-random-id " ).mock (return_value = Response (404 ))
419419
420420 with changing_dir (tmp_path ):
421421 result = runner .invoke (app , ["deploy" ])
You can’t perform that action at this time.
0 commit comments