@@ -25,15 +25,18 @@ def setup_terminal() -> None:
2525
2626
2727@pytest .fixture
28- def logged_in_cli () -> Generator [None , None , None ]:
29- with patch ("fastapi_cloud_cli.utils.auth.get_auth_token" , return_value = True ):
30- yield
28+ def logged_in_cli (temp_auth_config ) -> Generator [None , None , None ]:
29+ # Create auth file with test token
30+ temp_auth_config .write_text ('{"access_token": "test_token_12345"}' )
31+ yield
3132
3233
3334@pytest .fixture
34- def logged_out_cli () -> Generator [None , None , None ]:
35- with patch ("fastapi_cloud_cli.utils.auth.get_auth_token" , return_value = None ):
36- yield
35+ def logged_out_cli (temp_auth_config ) -> Generator [None , None , None ]:
36+ # Ensure no auth file exists
37+ if temp_auth_config .exists ():
38+ temp_auth_config .unlink ()
39+ yield
3740
3841
3942@dataclass
@@ -54,3 +57,10 @@ def configured_app(tmp_path: Path) -> ConfiguredApp:
5457 config_path .write_text (f'{{"app_id": "{ app_id } ", "team_id": "{ team_id } "}}' )
5558
5659 return ConfiguredApp (app_id = app_id , team_id = team_id , path = tmp_path )
60+
61+
62+ @pytest .fixture
63+ def temp_auth_config (tmp_path : Path ) -> Generator [Path , None , None ]:
64+ """Provides a temporary auth config setup for testing file operations."""
65+ with patch ("fastapi_cloud_cli.utils.config.get_config_folder" , return_value = tmp_path ):
66+ yield tmp_path / "auth.json"
0 commit comments