Skip to content

Commit ec44361

Browse files
test: update CLI tests for --host flag change
- Replace -h shorthand with --host (removed to avoid -h/--help conflict) - Use separate arguments instead of concatenated form - Use prefix variable for schema name consistency - Fix assertion string matching Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 73f9fba commit ec44361

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/integration/test_cli.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_cli_config():
5050

5151
def test_cli_args():
5252
process = subprocess.Popen(
53-
["dj", "-utest_user", "-ptest_pass", "-htest_host"],
53+
["dj", "-u", "test_user", "-p", "test_pass", "--host", "test_host"],
5454
stdin=subprocess.PIPE,
5555
stdout=subprocess.PIPE,
5656
stderr=subprocess.PIPE,
@@ -63,9 +63,9 @@ def test_cli_args():
6363
process.stdin.flush()
6464

6565
stdout, stderr = process.communicate()
66-
assert "test_user" == stdout[5:14]
67-
assert "test_pass" == stdout[21:30]
68-
assert "test_host" == stdout[37:46]
66+
assert "test_user" in stdout
67+
assert "test_pass" in stdout
68+
assert "test_host" in stdout
6969

7070

7171
def test_cli_schemas(prefix, connection_root, db_creds_root):
@@ -83,11 +83,11 @@ class IJ(dj.Lookup):
8383
process = subprocess.Popen(
8484
[
8585
"dj",
86-
f"-u{db_creds_root['user']}",
87-
f"-p{db_creds_root['password']}",
88-
f"-h{db_creds_root['host']}",
86+
"-u", db_creds_root['user'],
87+
"-p", db_creds_root['password'],
88+
"--host", db_creds_root['host'],
8989
"-s",
90-
"djtest_cli:test_schema",
90+
f"{prefix}_cli:test_schema",
9191
],
9292
stdin=subprocess.PIPE,
9393
stdout=subprocess.PIPE,
@@ -116,6 +116,6 @@ class IJ(dj.Lookup):
116116
cleaned = stdout.strip(" >\t\n\r")
117117
for key in (
118118
"test_schema",
119-
"Schema `djtest_cli`",
119+
f"Schema `{prefix}_cli`",
120120
):
121-
assert key in cleaned, f"Key {key} not found in config from stdout: {cleaned}"
121+
assert key in cleaned, f"Key {key} not found in stdout: {cleaned}"

0 commit comments

Comments
 (0)