scim2-models 0.3.0__tar.gz → 0.3.2__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.
- {scim2_models-0.3.0 → scim2_models-0.3.2}/.pre-commit-config.yaml +3 -3
- {scim2_models-0.3.0 → scim2_models-0.3.2}/PKG-INFO +3 -2
- {scim2_models-0.3.0 → scim2_models-0.3.2}/doc/changelog.rst +15 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/pyproject.toml +1 -1
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/base.py +9 -5
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7643/schema.py +1 -1
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7644/list_response.py +13 -1
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7644/search_request.py +5 -5
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_dynamic_resources.py +3 -3
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_list_response.py +23 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_schema.py +3 -3
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_search_request.py +5 -8
- scim2_models-0.3.2/uv.lock +1355 -0
- scim2_models-0.3.0/uv.lock +0 -1200
- {scim2_models-0.3.0 → scim2_models-0.3.2}/.github/FUNDING.yml +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/.github/workflows/release.yml +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/.github/workflows/tests.yaml +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/.gitignore +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/.readthedocs.yml +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/LICENSE +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/README.md +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/conftest.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/doc/__init__.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/doc/conf.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/doc/contributing.rst +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/doc/index.rst +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/doc/reference.rst +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/doc/tutorial.rst +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7643-8.1-user-minimal.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7643-8.2-user-full.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7643-8.3-enterprise_user.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7643-8.4-group.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7643-8.5-service_provider_configuration.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7643-8.6-resource_type-group.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7643-8.6-resource_type-user.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7643-8.7.1-schema-enterprise_user.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7643-8.7.1-schema-group.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7643-8.7.1-schema-user.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7643-8.7.2-schema-resource_type.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7643-8.7.2-schema-schema.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7643-8.7.2-schema-service_provider_configuration.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.12-error-bad_request.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.12-error-not_found.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.14-user-post_request.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.14-user-post_response.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.3-user-post_request.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.3-user-post_response.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.4.1-user-known-resource.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.4.2-list_response-partial_attributes.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.4.3-list_response-post_query.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.4.3-search_request.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.5.1-user-put_request.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.5.1-user-put_response.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.5.2.1-patch_op-add_emails.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.5.2.1-patch_op-add_members.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.5.2.2-patch_op-remove_all_members.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.5.2.2-patch_op-remove_and_add_one_member.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.5.2.2-patch_op-remove_multi_complex_value.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.5.2.2-patch_op-remove_one_member.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.5.2.3-patch_op-replace_all_email_values.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.5.2.3-patch_op-replace_all_members.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.5.2.3-patch_op-replace_street_address.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.5.2.3-patch_op-replace_user_work_address.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.6-error-not_found.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.7.1-bulk_request-circular_conflict.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.7.1-list_response-circular_reference.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.7.2-bulk_request-enterprise_user.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.7.2-bulk_request-temporary_identifier.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.7.2-bulk_response-temporary_identifier.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.7.3-bulk_request-multiple_operations.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.7.3-bulk_response-error_invalid_syntax.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.7.3-bulk_response-multiple_errors.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.7.3-bulk_response-multiple_operations.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.7.3-error-invalid_syntax.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.7.4-error-payload_too_large.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-3.9-user-partial_response.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/samples/rfc7644-4-list_response-resource_types.json +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/__init__.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/constants.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/py.typed +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7643/__init__.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7643/enterprise_user.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7643/group.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7643/resource.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7643/resource_type.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7643/service_provider_config.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7643/user.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7644/__init__.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7644/bulk.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7644/error.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7644/message.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/rfc7644/patch_op.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/scim2_models/utils.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/__init__.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/conftest.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_dynamic_schemas.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_enterprise_user.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_errors.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_group.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_model_attributes.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_model_serialization.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_model_validation.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_models.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_patch_op.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_resource_extension.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_resource_type.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_service_provider_configuration.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_user.py +0 -0
- {scim2_models-0.3.0 → scim2_models-0.3.2}/tests/test_utils.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
repos:
|
|
3
3
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
4
|
-
rev: 'v0.
|
|
4
|
+
rev: 'v0.11.2'
|
|
5
5
|
hooks:
|
|
6
6
|
- id: ruff
|
|
7
7
|
args: [--fix, --exit-non-zero-on-fix]
|
|
@@ -16,11 +16,11 @@ repos:
|
|
|
16
16
|
exclude: "\\.svg$|\\.map$|\\.min\\.css$|\\.min\\.js$|\\.po$|\\.pot$"
|
|
17
17
|
- id: check-toml
|
|
18
18
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
19
|
-
rev: v1.
|
|
19
|
+
rev: v1.15.0
|
|
20
20
|
hooks:
|
|
21
21
|
- id: mypy
|
|
22
22
|
- repo: https://github.com/codespell-project/codespell
|
|
23
|
-
rev: v2.
|
|
23
|
+
rev: v2.4.1
|
|
24
24
|
hooks:
|
|
25
25
|
- id: codespell
|
|
26
26
|
additional_dependencies:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: scim2-models
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: SCIM2 models serialization and validation with pydantic
|
|
5
5
|
Project-URL: documentation, https://scim2-models.readthedocs.io
|
|
6
6
|
Project-URL: repository, https://github.com/python-scim/scim2-models
|
|
@@ -208,6 +208,7 @@ License: Apache License
|
|
|
208
208
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
209
209
|
See the License for the specific language governing permissions and
|
|
210
210
|
limitations under the License.
|
|
211
|
+
License-File: LICENSE
|
|
211
212
|
Keywords: provisioning,pydantic,rfc7643,rfc7644,scim,scim2
|
|
212
213
|
Classifier: Development Status :: 3 - Alpha
|
|
213
214
|
Classifier: Environment :: Web Environment
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
[0.3.2] - 2025-03-28
|
|
5
|
+
--------------------
|
|
6
|
+
|
|
7
|
+
Fixed
|
|
8
|
+
^^^^^
|
|
9
|
+
- Pydantic warning.
|
|
10
|
+
|
|
11
|
+
[0.3.1] - 2025-03-07
|
|
12
|
+
--------------------
|
|
13
|
+
|
|
14
|
+
Fixed
|
|
15
|
+
^^^^^
|
|
16
|
+
- Fix :attr:`~scim2_models.SearchRequest.start_index` and :attr:`~scim2_models.SearchRequest.count` limits. :issue:`84`
|
|
17
|
+
- :attr:`~scim2_models.ListResponse.total_resuls` is required. :issue:`88`
|
|
18
|
+
|
|
4
19
|
[0.3.0] - 2024-12-11
|
|
5
20
|
--------------------
|
|
6
21
|
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scim2-models"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.2"
|
|
8
8
|
description = "SCIM2 models serialization and validation with pydantic"
|
|
9
9
|
authors = [{name="Yaal Coop", email="contact@yaal.coop"}]
|
|
10
10
|
license = {file = "LICENSE"}
|
|
@@ -649,14 +649,14 @@ class BaseModel(PydanticBaseModel):
|
|
|
649
649
|
"""
|
|
650
650
|
from scim2_models.rfc7643.resource import Resource
|
|
651
651
|
|
|
652
|
-
for field_name in self.model_fields:
|
|
652
|
+
for field_name in self.__class__.model_fields:
|
|
653
653
|
attr_type = self.get_field_root_type(field_name)
|
|
654
654
|
if not is_complex_attribute(attr_type):
|
|
655
655
|
continue
|
|
656
656
|
|
|
657
657
|
main_schema = (
|
|
658
658
|
getattr(self, "_schema", None)
|
|
659
|
-
or self.model_fields["schemas"].default[0]
|
|
659
|
+
or self.__class__.model_fields["schemas"].default[0]
|
|
660
660
|
)
|
|
661
661
|
|
|
662
662
|
separator = ":" if isinstance(self, Resource) else "."
|
|
@@ -847,8 +847,10 @@ class BaseModel(PydanticBaseModel):
|
|
|
847
847
|
|
|
848
848
|
See :rfc:`RFC7644 §3.10 <7644#section-3.10>`.
|
|
849
849
|
"""
|
|
850
|
-
main_schema = self.model_fields["schemas"].default[0]
|
|
851
|
-
alias =
|
|
850
|
+
main_schema = self.__class__.model_fields["schemas"].default[0]
|
|
851
|
+
alias = (
|
|
852
|
+
self.__class__.model_fields[field_name].serialization_alias or field_name
|
|
853
|
+
)
|
|
852
854
|
|
|
853
855
|
# if alias contains a ':' this is an extension urn
|
|
854
856
|
full_urn = alias if ":" in alias else f"{main_schema}:{alias}"
|
|
@@ -865,7 +867,9 @@ class ComplexAttribute(BaseModel):
|
|
|
865
867
|
|
|
866
868
|
See :rfc:`RFC7644 §3.10 <7644#section-3.10>`.
|
|
867
869
|
"""
|
|
868
|
-
alias =
|
|
870
|
+
alias = (
|
|
871
|
+
self.__class__.model_fields[field_name].serialization_alias or field_name
|
|
872
|
+
)
|
|
869
873
|
return f"{self._schema}.{alias}"
|
|
870
874
|
|
|
871
875
|
|
|
@@ -3,7 +3,7 @@ from datetime import datetime
|
|
|
3
3
|
from enum import Enum
|
|
4
4
|
from typing import Annotated
|
|
5
5
|
from typing import Any
|
|
6
|
-
from typing import List # noqa : UP005
|
|
6
|
+
from typing import List # noqa : UP005,UP035
|
|
7
7
|
from typing import Literal
|
|
8
8
|
from typing import Optional
|
|
9
9
|
from typing import Union
|
|
@@ -104,7 +104,13 @@ class ListResponse(Message, Generic[AnyResource], metaclass=ListResponseMetaclas
|
|
|
104
104
|
def check_results_number(
|
|
105
105
|
cls, value: Any, handler: ValidatorFunctionWrapHandler, info: ValidationInfo
|
|
106
106
|
) -> Self:
|
|
107
|
-
"""
|
|
107
|
+
"""Validate result numbers.
|
|
108
|
+
|
|
109
|
+
:rfc:`RFC7644 §3.4.2 <7644#section-3.4.2.4>` indicates that:
|
|
110
|
+
|
|
111
|
+
- 'totalResults' is required
|
|
112
|
+
- 'resources' must be set if 'totalResults' is non-zero.
|
|
113
|
+
"""
|
|
108
114
|
obj = handler(value)
|
|
109
115
|
|
|
110
116
|
if (
|
|
@@ -114,6 +120,12 @@ class ListResponse(Message, Generic[AnyResource], metaclass=ListResponseMetaclas
|
|
|
114
120
|
):
|
|
115
121
|
return obj
|
|
116
122
|
|
|
123
|
+
if obj.total_results is None:
|
|
124
|
+
raise PydanticCustomError(
|
|
125
|
+
"required_error",
|
|
126
|
+
"Field 'total_results' is required but value is missing or null",
|
|
127
|
+
)
|
|
128
|
+
|
|
117
129
|
if obj.total_results > 0 and not obj.resources:
|
|
118
130
|
raise PydanticCustomError(
|
|
119
131
|
"no_resource_error",
|
|
@@ -49,11 +49,11 @@ class SearchRequest(Message):
|
|
|
49
49
|
@field_validator("start_index")
|
|
50
50
|
@classmethod
|
|
51
51
|
def start_index_floor(cls, value: int) -> int:
|
|
52
|
-
"""According to :rfc:`RFC7644 §3.4.2 <7644#section-3.4.2.4>, start_index values less than
|
|
52
|
+
"""According to :rfc:`RFC7644 §3.4.2 <7644#section-3.4.2.4>, start_index values less than 1 are interpreted as 1.
|
|
53
53
|
|
|
54
54
|
A value less than 1 SHALL be interpreted as 1.
|
|
55
55
|
"""
|
|
56
|
-
return None if value is None else max(
|
|
56
|
+
return None if value is None else max(1, value)
|
|
57
57
|
|
|
58
58
|
count: Optional[int] = None
|
|
59
59
|
"""An integer indicating the desired maximum number of query results per
|
|
@@ -62,11 +62,11 @@ class SearchRequest(Message):
|
|
|
62
62
|
@field_validator("count")
|
|
63
63
|
@classmethod
|
|
64
64
|
def count_floor(cls, value: int) -> int:
|
|
65
|
-
"""According to :rfc:`RFC7644 §3.4.2 <7644#section-3.4.2.4>, count values less than
|
|
65
|
+
"""According to :rfc:`RFC7644 §3.4.2 <7644#section-3.4.2.4>, count values less than 0 are interpreted as 0.
|
|
66
66
|
|
|
67
|
-
A value
|
|
67
|
+
A negative value SHALL be interpreted as 0.
|
|
68
68
|
"""
|
|
69
|
-
return None if value is None else max(
|
|
69
|
+
return None if value is None else max(0, value)
|
|
70
70
|
|
|
71
71
|
@model_validator(mode="after")
|
|
72
72
|
def attributes_validator(self):
|
|
@@ -2720,7 +2720,7 @@ def test_make_schema_model_from_schema(load_sample):
|
|
|
2720
2720
|
assert obj.attributes[0].type == "string"
|
|
2721
2721
|
assert not obj.attributes[0].multi_valued
|
|
2722
2722
|
assert obj.attributes[0].description == (
|
|
2723
|
-
"A human-readable name for the Group.
|
|
2723
|
+
"A human-readable name for the Group. REQUIRED."
|
|
2724
2724
|
)
|
|
2725
2725
|
assert not obj.attributes[0].required
|
|
2726
2726
|
assert not obj.attributes[0].case_exact
|
|
@@ -2749,7 +2749,7 @@ def test_make_schema_model_from_schema(load_sample):
|
|
|
2749
2749
|
assert obj.attributes[1].sub_attributes[1].reference_types == ["User", "Group"]
|
|
2750
2750
|
assert not obj.attributes[1].sub_attributes[1].multi_valued
|
|
2751
2751
|
assert obj.attributes[1].sub_attributes[1].description == (
|
|
2752
|
-
"The URI corresponding to a SCIM resource
|
|
2752
|
+
"The URI corresponding to a SCIM resource that is a member of this Group."
|
|
2753
2753
|
)
|
|
2754
2754
|
assert not obj.attributes[1].sub_attributes[1].required
|
|
2755
2755
|
assert not obj.attributes[1].sub_attributes[1].case_exact
|
|
@@ -2760,7 +2760,7 @@ def test_make_schema_model_from_schema(load_sample):
|
|
|
2760
2760
|
assert obj.attributes[1].sub_attributes[2].type == "string"
|
|
2761
2761
|
assert not obj.attributes[1].sub_attributes[2].multi_valued
|
|
2762
2762
|
assert obj.attributes[1].sub_attributes[2].description == (
|
|
2763
|
-
"A label indicating the type of resource,
|
|
2763
|
+
"A label indicating the type of resource, e.g., 'User' or 'Group'."
|
|
2764
2764
|
)
|
|
2765
2765
|
assert not obj.attributes[1].sub_attributes[2].required
|
|
2766
2766
|
assert not obj.attributes[1].sub_attributes[2].case_exact
|
|
@@ -217,3 +217,26 @@ def test_list_response_schema_ordering():
|
|
|
217
217
|
],
|
|
218
218
|
}
|
|
219
219
|
ListResponse[Union[User[EnterpriseUser], Group]].model_validate(payload)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def test_total_results_required():
|
|
223
|
+
"""ListResponse.total_results is required."""
|
|
224
|
+
payload = {
|
|
225
|
+
"Resources": [
|
|
226
|
+
{
|
|
227
|
+
"schemas": [
|
|
228
|
+
"urn:ietf:params:scim:schemas:core:2.0:User",
|
|
229
|
+
],
|
|
230
|
+
"userName": "bjensen@example.com",
|
|
231
|
+
"id": "foobar",
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
with pytest.raises(
|
|
237
|
+
ValidationError,
|
|
238
|
+
match="Field 'total_results' is required but value is missing or null",
|
|
239
|
+
):
|
|
240
|
+
ListResponse[User].model_validate(
|
|
241
|
+
payload, scim_ctx=Context.RESOURCE_QUERY_RESPONSE
|
|
242
|
+
)
|
|
@@ -19,7 +19,7 @@ def test_group_schema(load_sample):
|
|
|
19
19
|
assert obj.attributes[0].type == Attribute.Type.string
|
|
20
20
|
assert not obj.attributes[0].multi_valued
|
|
21
21
|
assert obj.attributes[0].description == (
|
|
22
|
-
"A human-readable name for the Group.
|
|
22
|
+
"A human-readable name for the Group. REQUIRED."
|
|
23
23
|
)
|
|
24
24
|
assert not obj.attributes[0].required
|
|
25
25
|
assert not obj.attributes[0].case_exact
|
|
@@ -48,7 +48,7 @@ def test_group_schema(load_sample):
|
|
|
48
48
|
assert obj.attributes[1].sub_attributes[1].reference_types == ["User", "Group"]
|
|
49
49
|
assert not obj.attributes[1].sub_attributes[1].multi_valued
|
|
50
50
|
assert obj.attributes[1].sub_attributes[1].description == (
|
|
51
|
-
"The URI corresponding to a SCIM resource
|
|
51
|
+
"The URI corresponding to a SCIM resource that is a member of this Group."
|
|
52
52
|
)
|
|
53
53
|
assert not obj.attributes[1].sub_attributes[1].required
|
|
54
54
|
assert not obj.attributes[1].sub_attributes[1].case_exact
|
|
@@ -59,7 +59,7 @@ def test_group_schema(load_sample):
|
|
|
59
59
|
assert obj.attributes[1].sub_attributes[2].type == Attribute.Type.string
|
|
60
60
|
assert not obj.attributes[1].sub_attributes[2].multi_valued
|
|
61
61
|
assert obj.attributes[1].sub_attributes[2].description == (
|
|
62
|
-
"A label indicating the type of resource,
|
|
62
|
+
"A label indicating the type of resource, e.g., 'User' or 'Group'."
|
|
63
63
|
)
|
|
64
64
|
assert not obj.attributes[1].sub_attributes[2].required
|
|
65
65
|
assert not obj.attributes[1].sub_attributes[2].case_exact
|
|
@@ -29,13 +29,13 @@ def test_start_index_floor():
|
|
|
29
29
|
|
|
30
30
|
https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.4
|
|
31
31
|
|
|
32
|
-
A
|
|
32
|
+
A value less than 1 SHALL be interpreted as 1.
|
|
33
33
|
"""
|
|
34
34
|
sr = SearchRequest(start_index=100)
|
|
35
35
|
assert sr.start_index == 100
|
|
36
36
|
|
|
37
|
-
sr = SearchRequest(start_index
|
|
38
|
-
assert sr.start_index ==
|
|
37
|
+
sr = SearchRequest(start_index=0)
|
|
38
|
+
assert sr.start_index == 1
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
def test_count_floor():
|
|
@@ -43,16 +43,13 @@ def test_count_floor():
|
|
|
43
43
|
|
|
44
44
|
https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.4
|
|
45
45
|
|
|
46
|
-
A value
|
|
46
|
+
A negative value SHALL be interpreted as 0.
|
|
47
47
|
"""
|
|
48
48
|
sr = SearchRequest(count=100)
|
|
49
49
|
assert sr.count == 100
|
|
50
50
|
|
|
51
|
-
sr = SearchRequest(count=0)
|
|
52
|
-
assert sr.count == 1
|
|
53
|
-
|
|
54
51
|
sr = SearchRequest(count=-1)
|
|
55
|
-
assert sr.count ==
|
|
52
|
+
assert sr.count == 0
|
|
56
53
|
|
|
57
54
|
|
|
58
55
|
def test_attributes_or_excluded_attributes():
|