@@ -168,42 +168,8 @@ def test_fetch_access_token_handles_500_error(respx_mock: respx.MockRouter) -> N
168168def test_notify_already_logged_in_user (
169169 respx_mock : respx .MockRouter , logged_in_cli : None
170170) -> None :
171- respx_mock .get ("/users/me" ).mock (
172- return_value = Response (
200 ,
json = {
"email" :
"[email protected] " })
173- )
174-
175171 result = runner .invoke (app , ["login" ])
176172
177173 assert result .exit_code == 0
178- assert "Already logged in as [email protected] " in result .
output 174+ assert "You are already logged in. " in result .output
179175 assert "Run fastapi logout first if you want to switch accounts." in result .output
180-
181-
182- @pytest .mark .respx (base_url = settings .base_api_url )
183- def test_verify_token_returns_false_on_unauthorized (
184- respx_mock : respx .MockRouter ,
185- ) -> None :
186- from fastapi_cloud_cli .commands .login import _verify_token
187- from fastapi_cloud_cli .utils .api import APIClient
188-
189- respx_mock .get ("/users/me" ).mock (return_value = Response (401 ))
190-
191- with APIClient () as client :
192- is_valid , email = _verify_token (client )
193-
194- assert is_valid is False
195- assert email is None
196-
197-
198- @pytest .mark .respx (base_url = settings .base_api_url )
199- def test_verify_token_returns_false_on_forbidden (respx_mock : respx .MockRouter ) -> None :
200- from fastapi_cloud_cli .commands .login import _verify_token
201- from fastapi_cloud_cli .utils .api import APIClient
202-
203- respx_mock .get ("/users/me" ).mock (return_value = Response (403 ))
204-
205- with APIClient () as client :
206- is_valid , email = _verify_token (client )
207-
208- assert is_valid is False
209- assert email is None
0 commit comments