Coverage for tests/test_utils_apps.py: 100%
14 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-11-09 00:25 +0000
« prev ^ index » next coverage.py v7.16.0, created at 2026-11-09 00:25 +0000
1from pathlib import Path 1abcdefg
3from fastapi_cloud_cli.utils.apps import AppConfig, resolve_app_id 1abcdefg
6def test_resolve_app_id_prefers_explicit_app_id(tmp_path: Path) -> None: 1abcdefg
7 cloud_dir = tmp_path / ".fastapicloud" 1hijklmn
8 cloud_dir.mkdir() 1hijklmn
9 (cloud_dir / "cloud.json").write_text( 1hijklmn
10 AppConfig(app_id="linked-app", team_id="team").model_dump_json(),
11 encoding="utf-8",
12 )
14 assert resolve_app_id(app_id="explicit-app", path=tmp_path) == "explicit-app" 1hijklmn
17def test_resolve_app_id_uses_linked_app(tmp_path: Path) -> None: 1abcdefg
18 cloud_dir = tmp_path / ".fastapicloud" 1opqrstu
19 cloud_dir.mkdir() 1opqrstu
20 (cloud_dir / "cloud.json").write_text( 1opqrstu
21 AppConfig(app_id="linked-app", team_id="team").model_dump_json(),
22 encoding="utf-8",
23 )
25 assert resolve_app_id(path=tmp_path) == "linked-app" 1opqrstu
28def test_resolve_app_id_returns_none_without_app_context(tmp_path: Path) -> None: 1abcdefg
29 assert resolve_app_id(path=tmp_path) is None 1vwxyzAB