Skip to content

Commit a3e04fb

Browse files
committed
feat: raise exceptions when server URL are missing
1 parent 5305a5e commit a3e04fb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

scim2_cli/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ def cli(
111111
):
112112
"""SCIM application development CLI."""
113113
ctx.ensure_object(dict)
114+
115+
if not url:
116+
raise click.ClickException("No SCIM server URL defined.")
117+
114118
ctx.obj["URL"] = url
115119

116120
headers_dict = split_headers(header)

tests/test_cli.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
from scim2_cli import cli
1616

1717

18+
def test_no_url(runner):
19+
result = runner.invoke(cli, ["create"])
20+
assert result.exit_code == 1
21+
assert "No SCIM server URL defined.\n" in result.output
22+
23+
1824
def test_help(runner):
1925
result = runner.invoke(cli, ["--help"])
2026
assert result.exit_code == 0

0 commit comments

Comments
 (0)