scim2-client 0.1.3__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scim2-client
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Pythonically build SCIM requests and parse SCIM responses
5
5
  License: MIT
6
6
  Keywords: scim,scim2,provisioning,httpx,api
@@ -65,7 +65,8 @@ assert user.meta.last_updated == datetime.datetime(
65
65
  )
66
66
 
67
67
  # Create resources
68
- response = scim.create(User, "2819c223-7f76-453a-919d-413861904646")
68
+ payload = User(user_name="bjensen@example.com")
69
+ response = scim.create(user)
69
70
  assert isinstance(response, Error)
70
71
  assert response.detail == "One or more of the attribute values are already in use or are reserved."
71
72
  ```
@@ -40,7 +40,8 @@ assert user.meta.last_updated == datetime.datetime(
40
40
  )
41
41
 
42
42
  # Create resources
43
- response = scim.create(User, "2819c223-7f76-453a-919d-413861904646")
43
+ payload = User(user_name="bjensen@example.com")
44
+ response = scim.create(user)
44
45
  assert isinstance(response, Error)
45
46
  assert response.detail == "One or more of the attribute values are already in use or are reserved."
46
47
  ```
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "scim2-client"
7
- version = "0.1.3"
7
+ version = "0.1.4"
8
8
  description = "Pythonically build SCIM requests and parse SCIM responses"
9
9
  authors = ["Yaal Coop <contact@yaal.coop>"]
10
10
  license = "MIT"
@@ -106,7 +106,12 @@ class SCIMClient:
106
106
  raise ValueError(f"Unknown resource type: '{resource_type}'")
107
107
 
108
108
  def resource_endpoint(self, resource_type: Type):
109
- return f"/{resource_type.__name__}s"
109
+ try:
110
+ first_bracket_index = resource_type.__name__.index("[")
111
+ root_name = resource_type.__name__[:first_bracket_index]
112
+ except ValueError:
113
+ root_name = resource_type.__name__
114
+ return f"/{root_name}s"
110
115
 
111
116
  def check_response(
112
117
  self,