forked from fastapilabs/fastapi-cloud-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_cli_logout.py
More file actions
31 lines (17 loc) · 785 Bytes
/
test_cli_logout.py
File metadata and controls
31 lines (17 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from pathlib import Path
from typer.testing import CliRunner
from fastapi_cloud_cli.cli import cloud_app as app
runner = CliRunner()
def test_logout_with_existing_auth_file(temp_auth_config: Path) -> None:
temp_auth_config.write_text('{"access_token": "test_token"}')
assert temp_auth_config.exists()
result = runner.invoke(app, ["logout"])
assert result.exit_code == 0
assert "You are now logged out! 🚀" in result.output
assert not temp_auth_config.exists()
def test_logout_with_no_auth_file(temp_auth_config: Path) -> None:
assert not temp_auth_config.exists()
result = runner.invoke(app, ["logout"])
assert result.exit_code == 0
assert "You are now logged out! 🚀" in result.output
assert not temp_auth_config.exists()