Skip to content

Commit edef8c4

Browse files
committed
refactor: rename --headers in --header
1 parent 512c991 commit edef8c4

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

scim2_cli/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ def _is_pydantic_model(model: Any) -> TypeGuard[type[BaseModel]]:
4444
@click.option("--url", help="The SCIM server endpoint.", envvar="SCIM_CLI_URL")
4545
@click.option(
4646
"-h",
47-
"--headers",
47+
"--header",
4848
multiple=True,
4949
type=HeaderType(),
50-
help="Header to pass in the HTTP requests.",
50+
help="Headers to pass in the HTTP requests. Can be passed multiple times.",
5151
envvar="SCIM_CLI_HEADERS",
5252
)
5353
@click.pass_context
54-
def cli(ctx, url: str, headers: list[str]):
54+
def cli(ctx, url: str, header: list[str]):
5555
"""SCIM application development CLI."""
5656
ctx.ensure_object(dict)
5757
ctx.obj["URL"] = url
58-
headers_dict = split_headers(headers)
58+
headers_dict = split_headers(header)
5959
client = Client(base_url=ctx.obj["URL"], headers=headers_dict)
6060
ctx.obj["client"] = SyncSCIMClient(client, resource_models=(User, Group))
6161
ctx.obj["client"].register_naive_resource_types()

tests/test_cli.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ def test_stdin_bad_json(runner, httpserver):
2323
def test_auth_headers(runner, httpserver, simple_user_payload):
2424
"""Test passing auth bearer headers."""
2525
httpserver.expect_request(
26-
"/Users/foobar", method="GET", headers={"Authorization": "Bearer token"}
26+
"/Users/foobar",
27+
method="GET",
28+
headers={"Authorization": "Bearer token", "foo": "bar"},
2729
).respond_with_json(
2830
simple_user_payload("foobar"),
2931
status=200,
@@ -47,8 +49,10 @@ def test_auth_headers(runner, httpserver, simple_user_payload):
4749
[
4850
"--url",
4951
httpserver.url_for("/"),
50-
"--headers",
52+
"--header",
5153
"Authorization: Bearer token",
54+
"--header",
55+
"foo: bar",
5256
"query",
5357
"user",
5458
"foobar",
@@ -60,7 +64,9 @@ def test_auth_headers(runner, httpserver, simple_user_payload):
6064
def test_env_vars(runner, httpserver, simple_user_payload):
6165
"""Test passing host and headers with environment vars."""
6266
httpserver.expect_request(
63-
"/Users/foobar", method="GET", headers={"Authorization": "Bearer token"}
67+
"/Users/foobar",
68+
method="GET",
69+
headers={"Authorization": "Bearer token", "foo": "bar"},
6470
).respond_with_json(
6571
simple_user_payload("foobar"),
6672
status=200,

0 commit comments

Comments
 (0)