File tree 3 files changed +14
-14
lines changed
3 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -229,7 +229,11 @@ def _configure_app(
229
229
230
230
progress .log (f"App created successfully! App slug: { app_data .slug } " )
231
231
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
233
237
234
238
235
239
def _wait_for_deployment (
@@ -318,11 +322,11 @@ def deploy(
318
322
toolkit , path_to_deploy = path_to_deploy
319
323
)
320
324
else :
321
- toolkit .print (f "Deploying app [blue] { app_config . slug } [blue] ..." )
325
+ toolkit .print ("Deploying app..." )
322
326
toolkit .print_line ()
323
327
324
328
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 )
326
330
327
331
if not app_data :
328
332
progress .set_error (
@@ -353,7 +357,7 @@ def deploy(
353
357
354
358
check_deployment_url = (
355
359
settings .base_frontend_url
356
- + f"/apps/{ app_config .slug } /deployments/{ deployment .id } "
360
+ + f"/apps/{ app_data .slug } /deployments/{ deployment .id } "
357
361
)
358
362
359
363
if not skip_wait :
Original file line number Diff line number Diff line change 5
5
6
6
7
7
class AppConfig (BaseModel ):
8
- slug : str
8
+ app_id : str
9
9
10
10
11
11
def get_app_config (path_to_deploy : Path ) -> Optional [AppConfig ]:
@@ -17,15 +17,11 @@ def get_app_config(path_to_deploy: Path) -> Optional[AppConfig]:
17
17
return AppConfig .model_validate_json (config_path .read_text (encoding = "utf-8" ))
18
18
19
19
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 :
21
21
config_path = path_to_deploy / ".fastapi/cloud.json"
22
22
config_path .parent .mkdir (parents = True , exist_ok = True )
23
23
24
- app_config = AppConfig (slug = slug )
25
-
26
24
config_path .write_text (
27
25
app_config .model_dump_json (),
28
26
encoding = "utf-8" ,
29
27
)
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(
346
346
config_path = tmp_path / ".fastapi" / "cloud.json"
347
347
348
348
config_path .parent .mkdir (parents = True , exist_ok = True )
349
- config_path .write_text ('{"slug ": "demo "}' )
349
+ config_path .write_text ('{"app_id ": "1234 "}' )
350
350
351
- respx_mock .get ("/apps/demo " ).mock (
351
+ respx_mock .get ("/apps/1234 " ).mock (
352
352
return_value = Response (200 , json = {"slug" : "demo" , "id" : "1234" })
353
353
)
354
354
@@ -413,9 +413,9 @@ def test_shows_error_when_app_does_not_exist(
413
413
config_path = tmp_path / ".fastapi" / "cloud.json"
414
414
415
415
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 "}' )
417
417
418
- respx_mock .get ("/apps/demo " ).mock (return_value = Response (404 ))
418
+ respx_mock .get ("/apps/some-random-id " ).mock (return_value = Response (404 ))
419
419
420
420
with changing_dir (tmp_path ):
421
421
result = runner .invoke (app , ["deploy" ])
You can’t perform that action at this time.
0 commit comments