Skip to content

Commit 4b04606

Browse files
committed
chore: compatibility with scim2-client 0.3.0
1 parent b3378ec commit 4b04606

File tree

8 files changed

+158
-120
lines changed

8 files changed

+158
-120
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
repos:
33
- repo: https://github.com/astral-sh/ruff-pre-commit
4-
rev: 'v0.6.4'
4+
rev: 'v0.8.1'
55
hooks:
66
- id: ruff
77
args: [--fix, --exit-non-zero-on-fix]
88
- id: ruff-format
99
- repo: https://github.com/pre-commit/pre-commit-hooks
10-
rev: v4.6.0
10+
rev: v5.0.0
1111
hooks:
1212
- id: fix-byte-order-marker
1313
- id: trailing-whitespace
@@ -16,7 +16,7 @@ repos:
1616
exclude: "\\.svg$|\\.map$|\\.min\\.css$|\\.min\\.js$|\\.po$|\\.pot$"
1717
- id: check-toml
1818
- repo: https://github.com/pre-commit/mirrors-mypy
19-
rev: v1.11.2
19+
rev: v1.13.0
2020
hooks:
2121
- id: mypy
2222
- repo: https://github.com/codespell-project/codespell

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ requires-python = ">= 3.10"
2828
dependencies = [
2929
"click>=8.1.7",
3030
"scim2-client>=0.2.0",
31-
"scim2-tester>=0.1.3",
31+
"scim2-tester[httpx]>=0.1.3",
3232
"sphinx-click-rst-to-ansi-formatter>=0.1.0",
3333
"pydanclick>=0.3.0",
3434
"pygments>=2.18.0",

scim2_cli/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import click
44
from httpx import Client
5-
from scim2_client import SCIMClient
5+
from scim2_client.engines.httpx import SyncSCIMClient
66
from scim2_models import Group
77
from scim2_models import User
88
from sphinx_click.rst_to_ansi_formatter import make_rst_to_ansi_formatter
@@ -24,10 +24,10 @@ def cli(ctx, url):
2424
ctx.ensure_object(dict)
2525
ctx.obj["URL"] = url
2626
client = Client(base_url=ctx.obj["URL"])
27-
ctx.obj["client"] = SCIMClient(client, resource_types=(User, Group))
28-
ctx.obj["resource_types"] = {
29-
resource_type.__name__.lower(): resource_type
30-
for resource_type in ctx.obj["client"].resource_types
27+
ctx.obj["client"] = SyncSCIMClient(client, resource_models=(User, Group))
28+
ctx.obj["resource_models"] = {
29+
resource_model.__name__.lower(): resource_model
30+
for resource_model in ctx.obj["client"].resource_models
3131
}
3232

3333
if not click.get_text_stream("stdin").isatty(): # pragma: no cover

scim2_cli/delete.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ def delete_cli(ctx, resource_type, id, headers, indent):
3333
scim https://scim.example delete user 1234
3434
"""
3535
try:
36-
resource_type = ctx.obj["resource_types"][resource_type]
36+
resource_model = ctx.obj["resource_models"][resource_type]
3737
except KeyError as exc:
38-
ok_values = ", ".join(ctx.obj["resource_types"])
38+
ok_values = ", ".join(ctx.obj["resource_models"])
3939
raise ClickException(
4040
f"Unknown resource type '{resource_type}'. Available values are: {ok_values}'"
4141
) from exc
4242

4343
try:
4444
response = ctx.obj["client"].delete(
45-
resource_type, id, headers=split_headers(headers), raise_scim_errors=False
45+
resource_model, id, headers=split_headers(headers), raise_scim_errors=False
4646
)
4747

4848
except SCIMClientError as scim_exc:

scim2_cli/query.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ def query_cli(
8484
"""
8585
if resource_type:
8686
try:
87-
resource_type = ctx.obj["resource_types"][resource_type]
87+
resource_type = ctx.obj["resource_models"][resource_type]
8888
except KeyError as exc:
89-
ok_values = ", ".join(ctx.obj["resource_types"])
89+
ok_values = ", ".join(ctx.obj["resource_models"])
9090
raise ClickException(
9191
f"Unknown resource type '{resource_type}. Available values are: {ok_values}'"
9292
) from exc

scim2_cli/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ def __init__(self, *args, factory, **kwargs):
5656
def list_commands(self, ctx):
5757
ctx.ensure_object(dict)
5858
base = super().list_commands(ctx)
59-
lazy = sorted(ctx.obj.get("resource_types", {}).keys())
59+
lazy = sorted(ctx.obj.get("resource_models", {}).keys())
6060
return base + lazy
6161

6262
def get_command(self, ctx, cmd_name):
63-
model = ctx.obj["resource_types"].get(cmd_name)
63+
model = ctx.obj["resource_models"].get(cmd_name)
6464
return self.factory(model)
6565

6666

tests/test_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def httpserver(httpserver, simple_user_payload):
5858

5959
httpserver.expect_request(
6060
"/Users/full-qs",
61-
query_string="attributes=userName&attributes=displayName&filter=userName%20Eq%20%22john%22&sortBy=userName&sortOrder=ascending&startIndex=1&count=10",
61+
query_string="attributes=userName&attributes=displayName&filter=userName+Eq+%22john%22&sortBy=userName&sortOrder=ascending&startIndex=1&count=10",
6262
method="GET",
6363
).respond_with_json(
6464
simple_user_payload("full-qs"),

uv.lock

Lines changed: 141 additions & 103 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)