Skip to content

Commit ff86d5f

Browse files
better tests
1 parent 318e984 commit ff86d5f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/test_cli/test_cli_apikeyctl.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,22 @@
66

77

88
def test_cli_apikeyctl(bbot_server_http):
9-
# we shouldn't have any presets yet
9+
api_key = bbcfg.get_api_key()
10+
assert api_key
11+
api_key = str(api_key)
12+
13+
# text output
14+
command = BBCTL_COMMAND + ["server", "apikey", "list"]
15+
process = subprocess.run(command, capture_output=True, text=True)
16+
assert process.returncode == 0
17+
assert api_key in process.stdout
18+
19+
# JSON output
1020
command = BBCTL_COMMAND + ["server", "apikey", "list", "--json"]
1121
process = subprocess.run(command, capture_output=True, text=True)
12-
print(process.stdout)
13-
print(process.stderr)
1422
assert process.returncode == 0
1523
output = orjson.loads(process.stdout)
1624
assert output
1725
assert isinstance(output, list)
1826
assert len(output) == 1
19-
assert output == [str(bbcfg.get_api_key())]
27+
assert output == [api_key]

0 commit comments

Comments
 (0)