Skip to content

Commit e887c3b

Browse files
committed
✅ Update tests
1 parent 4ddb15d commit e887c3b

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

tests/test_cli_deploy.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def test_asks_for_app_name_after_team(
316316
def test_creates_app_on_backend(
317317
logged_in_cli: None, tmp_path: Path, respx_mock: respx.MockRouter
318318
) -> None:
319-
steps = [Keys.ENTER, Keys.ENTER, *"demo", Keys.ENTER]
319+
steps = [Keys.ENTER, Keys.ENTER, *"demo", Keys.ENTER, Keys.ENTER]
320320

321321
team = _get_random_team()
322322

@@ -344,6 +344,40 @@ def test_creates_app_on_backend(
344344
assert "App created successfully" in result.output
345345

346346

347+
@pytest.mark.respx(base_url=settings.base_api_url)
348+
def test_cancels_deployment_when_user_selects_no(
349+
logged_in_cli: None, tmp_path: Path, respx_mock: respx.MockRouter
350+
) -> None:
351+
steps = [
352+
Keys.ENTER,
353+
Keys.ENTER,
354+
*"demo",
355+
Keys.ENTER,
356+
Keys.DOWN_ARROW,
357+
Keys.ENTER,
358+
]
359+
360+
team = _get_random_team()
361+
362+
respx_mock.get("/teams/").mock(
363+
return_value=Response(
364+
200,
365+
json={"data": [team]},
366+
)
367+
)
368+
369+
with (
370+
changing_dir(tmp_path),
371+
patch("rich_toolkit.container.getchar") as mock_getchar,
372+
):
373+
mock_getchar.side_effect = steps
374+
375+
result = runner.invoke(app, ["deploy"])
376+
377+
assert result.exit_code == 0
378+
assert "Deployment cancelled." in result.output
379+
380+
347381
@pytest.mark.respx(base_url=settings.base_api_url)
348382
def test_uses_existing_app(
349383
logged_in_cli: None, tmp_path: Path, respx_mock: respx.MockRouter
@@ -383,6 +417,7 @@ def test_exits_successfully_when_deployment_is_done(
383417
Keys.ENTER,
384418
*"demo",
385419
Keys.ENTER,
420+
Keys.ENTER,
386421
]
387422

388423
team_data = _get_random_team()
@@ -633,6 +668,7 @@ def _deploy_without_waiting(respx_mock: respx.MockRouter, tmp_path: Path) -> Res
633668
Keys.ENTER,
634669
*"demo",
635670
Keys.ENTER,
671+
Keys.ENTER,
636672
]
637673

638674
team_data = _get_random_team()

0 commit comments

Comments
 (0)