@@ -221,78 +221,6 @@ def test_uses_existing_app(
221221 assert app_data ["slug" ] in result .output
222222
223223
224- @pytest .mark .respx (base_url = settings .base_api_url )
225- def test_creates_and_uploads_deployment_then_fails (
226- logged_in_cli : None , tmp_path : Path , respx_mock : respx .MockRouter
227- ) -> None :
228- steps = [
229- Keys .ENTER ,
230- Keys .ENTER ,
231- Keys .ENTER ,
232- * "demo" ,
233- Keys .ENTER ,
234- Keys .RIGHT_ARROW ,
235- Keys .ENTER ,
236- ]
237-
238- team = _get_random_team ()
239- app_data = _get_random_app (team_id = team ["id" ])
240-
241- respx_mock .get ("/teams/" ).mock (return_value = Response (200 , json = {"data" : [team ]}))
242-
243- respx_mock .post ("/apps/" , json = {"name" : "demo" , "team_id" : team ["id" ]}).mock (
244- return_value = Response (201 , json = app_data )
245- )
246-
247- respx_mock .get (f"/apps/{ app_data ['id' ]} " ).mock (
248- return_value = Response (200 , json = app_data )
249- )
250-
251- deployment_data = _get_random_deployment (app_id = app_data ["id" ])
252-
253- respx_mock .post (f"/apps/{ app_data ['id' ]} /deployments/" ).mock (
254- return_value = Response (201 , json = deployment_data )
255- )
256- respx_mock .post (
257- f"/deployments/{ deployment_data ['id' ]} /upload" ,
258- ).mock (
259- return_value = Response (
260- 200 ,
261- json = {
262- "url" : "http://test.com" ,
263- "fields" : {"key" : "value" },
264- },
265- )
266- )
267-
268- respx_mock .post (
269- "http://test.com" ,
270- data = {"key" : "value" },
271- ).mock (return_value = Response (200 ))
272-
273- respx_mock .get (
274- f"/apps/{ app_data ['id' ]} /deployments/{ deployment_data ['id' ]} " ,
275- ).mock (
276- return_value = Response (
277- 200 ,
278- json = _get_random_deployment (app_id = app_data ["id" ], status = "failed" ),
279- )
280- )
281-
282- respx_mock .post (
283- f"/deployments/{ deployment_data ['id' ]} /upload-complete" ,
284- ).mock (return_value = Response (200 ))
285-
286- with changing_dir (tmp_path ), patch ("click.getchar" ) as mock_getchar :
287- mock_getchar .side_effect = steps
288-
289- result = runner .invoke (app , ["deploy" ])
290-
291- assert result .exit_code == 1
292-
293- assert "Checking the status of your deployment" in result .output
294-
295-
296224@pytest .mark .respx (base_url = settings .base_api_url )
297225def test_exits_successfully_when_deployment_is_done (
298226 logged_in_cli : None , tmp_path : Path , respx_mock : respx .MockRouter
@@ -346,9 +274,12 @@ def test_exits_successfully_when_deployment_is_done(
346274 data = {"key" : "value" },
347275 ).mock (return_value = Response (200 ))
348276
349- respx_mock .get (f"/apps/ { app_data [ 'id' ] } / deployments/{ deployment_data ['id' ]} " ).mock (
277+ respx_mock .get (f"/deployments/{ deployment_data ['id' ]} /build-logs " ).mock (
350278 return_value = Response (
351- 200 , json = _get_random_deployment (app_id = app_data ["id" ], status = "success" )
279+ 200 ,
280+ json = {
281+ "message" : "Hello, world!" ,
282+ },
352283 )
353284 )
354285
@@ -359,7 +290,7 @@ def test_exits_successfully_when_deployment_is_done(
359290
360291 assert result .exit_code == 0
361292
362- assert "Ready the chicken! Your app is ready at" in result . output
293+ # TODO: show a message when the deployment is done (based on the status)
363294
364295
365296@pytest .mark .respx (base_url = settings .base_api_url )
@@ -394,9 +325,12 @@ def test_exists_successfully_when_deployment_is_done_when_app_is_configured(
394325 return_value = Response (200 )
395326 )
396327
397- respx_mock .get (f"/apps/ { app_id } / deployments/{ deployment_data ['id' ]} " ).mock (
328+ respx_mock .get (f"/deployments/{ deployment_data ['id' ]} /build-logs " ).mock (
398329 return_value = Response (
399- 200 , json = _get_random_deployment (app_id = app_id , status = "success" )
330+ 200 ,
331+ json = {
332+ "message" : "Hello, world!" ,
333+ },
400334 )
401335 )
402336
@@ -409,7 +343,7 @@ def test_exists_successfully_when_deployment_is_done_when_app_is_configured(
409343
410344 assert result .exit_code == 0
411345
412- assert "Ready the chicken! Your app is ready at" in result . output
346+ # TODO: show a message when the deployment is done (based on the status)
413347
414348
415349@pytest .mark .respx (base_url = settings .base_api_url )
0 commit comments