unitysvc-core 0.3.5__tar.gz → 0.3.6__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.
- {unitysvc_core-0.3.5/src/unitysvc_core.egg-info → unitysvc_core-0.3.6}/PKG-INFO +2 -2
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/README.md +1 -1
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/pyproject.toml +1 -1
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/grants.py +12 -4
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6/src/unitysvc_core.egg-info}/PKG-INFO +2 -2
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_grants.py +25 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/LICENSE +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/setup.cfg +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/__init__.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/__init__.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/base.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/channel.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/documents.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/listing_data.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/listing_v1.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/offering_data.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/offering_v1.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/pricing.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/promotion_data.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/provider_data.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/provider_v1.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/service.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/service_group_data.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/models/validators.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/parameter_usage.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/py.typed +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/schema/base.json +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/schema/listing_v1.json +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/schema/offering_v1.json +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/schema/promotion_v1.json +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/schema/provider_v1.json +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/schema/service_group_v1.json +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/utils.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core/validator.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core.egg-info/SOURCES.txt +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core.egg-info/dependency_links.txt +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core.egg-info/requires.txt +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/src/unitysvc_core.egg-info/top_level.txt +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_access_interface_routing.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_canonical_interfaces.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_channel.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_effective_price.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_external_apps.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_hidden_path_skip.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_listing_audience.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_offering_data.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_parameter_usage.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_pricing.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_provider_account_rate_limits.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_service_group.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_service_status.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_utils.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_validate_service.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_validator.py +0 -0
- {unitysvc_core-0.3.5 → unitysvc_core-0.3.6}/tests/test_validators.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: unitysvc-core
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
4
4
|
Summary: Shared data models and validation helpers for UnitySVC packages
|
|
5
5
|
Author-email: Bo Peng <bo.peng@unitysvc.com>
|
|
6
6
|
Maintainer-email: Bo Peng <bo.peng@unitysvc.com>
|
|
@@ -214,7 +214,7 @@ Three stages (unitysvc/unitysvc#2720): a target service's **`exports`** (what it
|
|
|
214
214
|
- **A request's `options` are fixed.** Every option it declares is in the policy of an approved request, with the declared value; the customer may repeat it but not change or drop it. An option the request does not declare is the customer's to set at enrollment (a form rendered from the target's `options` schema). So `{"object": "service:ai", ...}` lets the customer pick the AI service, and `"options": "service=labs/llm-balanced"` pins it.
|
|
215
215
|
- Several requests may name one object (two kinds of room) only if each fixes some option to a different value (`kind=chat`, `kind=feed`), so an approval says which one it is.
|
|
216
216
|
- `limits` (`validate_limits`): `count_per_hour` / `count_per_day` / `count_per_month` / `count_total` (positive integer) and the same for `amount_` (finite positive decimal, as a number or a string). Limits are universal: the platform meters every call, so any service can be limited without exporting anything. The seller's limits only pre-fill the form; the customer sets them at enrollment, and an enrollment's own limits (unitysvc/unitysvc#2687) use the same shape. They are counted per policy entry (the enrollment's calls to that service) from the usage stream (counters keyed by scope, metric and window bucket), and the gateway refuses calls once one is exceeded.
|
|
217
|
-
- **A room the platform provisions** (unitysvc/unitysvc#2830) is asked for with `resource:room`: `{"object": "resource:room", "permissions": ["create"], "required": true, "justification": "Creates your chat room", "options": "kind=chat&max_members=100"}`. Core knows the resource, so no catalog is consulted. The request must fix `kind`, the room's identity; each kind bounds the permissions (`chat`: `create`, a room the customer owns; `support`: `join`, `read`, `post`, the seller's private room with the customer; `announcement`: `join`, `read`; `discussion`: `join`, `read`, `post`). `max_members` (a positive integer) caps only a room the customer creates. A channel requests each kind at most once, and a resource takes no limits.
|
|
217
|
+
- **A room the platform provisions** (unitysvc/unitysvc#2830) is asked for with `resource:room`: `{"object": "resource:room", "permissions": ["create"], "required": true, "justification": "Creates your chat room", "options": "kind=chat&max_members=100"}`. Core knows the resource, so no catalog is consulted. The request must fix `kind`, the room's identity; each kind bounds the permissions (`chat`: `create`, a room the customer owns; `support`: `join`, `read`, `post`, the seller's private room with the customer; `announcement`: `join`, `read`; `discussion`: `join`, `read`, `post`). `max_members` (a positive integer) caps only a room the customer creates; `max_retention` (seconds, 0 or more) caps how long any provisioned room keeps messages, within the platform's own ceiling for the kind, and the room's owner may keep less. A channel requests each kind at most once, and a resource takes no limits.
|
|
218
218
|
- **A longer-lived leased key** is asked for with one `apikey` entry: `{"object": "apikey", "required": false, "limits": {"api_key_lifespan": 14400}, "justification": "Batch runs take up to four hours"}`. It names the key itself, so it takes only `limits` (exactly `api_key_lifespan`, whole seconds from 1 to 86400), `required` and a `justification`, needs no catalog lookup, and grants nothing. Without it, a key the seller leases for the enrollment lives `DEFAULT_API_KEY_LIFESPAN` (3600 s). `api_key_lifespan` is valid only on this entry.
|
|
219
219
|
|
|
220
220
|
**3. How options reach the service.** Not through the upstream URL: the gateway never changes a target's `base_url` or query to carry policy. How an option is applied is up to the service's implementation:
|
|
@@ -179,7 +179,7 @@ Three stages (unitysvc/unitysvc#2720): a target service's **`exports`** (what it
|
|
|
179
179
|
- **A request's `options` are fixed.** Every option it declares is in the policy of an approved request, with the declared value; the customer may repeat it but not change or drop it. An option the request does not declare is the customer's to set at enrollment (a form rendered from the target's `options` schema). So `{"object": "service:ai", ...}` lets the customer pick the AI service, and `"options": "service=labs/llm-balanced"` pins it.
|
|
180
180
|
- Several requests may name one object (two kinds of room) only if each fixes some option to a different value (`kind=chat`, `kind=feed`), so an approval says which one it is.
|
|
181
181
|
- `limits` (`validate_limits`): `count_per_hour` / `count_per_day` / `count_per_month` / `count_total` (positive integer) and the same for `amount_` (finite positive decimal, as a number or a string). Limits are universal: the platform meters every call, so any service can be limited without exporting anything. The seller's limits only pre-fill the form; the customer sets them at enrollment, and an enrollment's own limits (unitysvc/unitysvc#2687) use the same shape. They are counted per policy entry (the enrollment's calls to that service) from the usage stream (counters keyed by scope, metric and window bucket), and the gateway refuses calls once one is exceeded.
|
|
182
|
-
- **A room the platform provisions** (unitysvc/unitysvc#2830) is asked for with `resource:room`: `{"object": "resource:room", "permissions": ["create"], "required": true, "justification": "Creates your chat room", "options": "kind=chat&max_members=100"}`. Core knows the resource, so no catalog is consulted. The request must fix `kind`, the room's identity; each kind bounds the permissions (`chat`: `create`, a room the customer owns; `support`: `join`, `read`, `post`, the seller's private room with the customer; `announcement`: `join`, `read`; `discussion`: `join`, `read`, `post`). `max_members` (a positive integer) caps only a room the customer creates. A channel requests each kind at most once, and a resource takes no limits.
|
|
182
|
+
- **A room the platform provisions** (unitysvc/unitysvc#2830) is asked for with `resource:room`: `{"object": "resource:room", "permissions": ["create"], "required": true, "justification": "Creates your chat room", "options": "kind=chat&max_members=100"}`. Core knows the resource, so no catalog is consulted. The request must fix `kind`, the room's identity; each kind bounds the permissions (`chat`: `create`, a room the customer owns; `support`: `join`, `read`, `post`, the seller's private room with the customer; `announcement`: `join`, `read`; `discussion`: `join`, `read`, `post`). `max_members` (a positive integer) caps only a room the customer creates; `max_retention` (seconds, 0 or more) caps how long any provisioned room keeps messages, within the platform's own ceiling for the kind, and the room's owner may keep less. A channel requests each kind at most once, and a resource takes no limits.
|
|
183
183
|
- **A longer-lived leased key** is asked for with one `apikey` entry: `{"object": "apikey", "required": false, "limits": {"api_key_lifespan": 14400}, "justification": "Batch runs take up to four hours"}`. It names the key itself, so it takes only `limits` (exactly `api_key_lifespan`, whole seconds from 1 to 86400), `required` and a `justification`, needs no catalog lookup, and grants nothing. Without it, a key the seller leases for the enrollment lives `DEFAULT_API_KEY_LIFESPAN` (3600 s). `api_key_lifespan` is valid only on this entry.
|
|
184
184
|
|
|
185
185
|
**3. How options reach the service.** Not through the upstream URL: the gateway never changes a target's `base_url` or query to carry policy. How an option is applied is up to the service's implementation:
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "unitysvc-core"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.6"
|
|
8
8
|
description = "Shared data models and validation helpers for UnitySVC packages"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "Bo Peng", email = "bo.peng@unitysvc.com" }]
|
|
@@ -81,7 +81,9 @@ customer consent and key issuance establish its *authority*.
|
|
|
81
81
|
A request's ``object`` is ``service:<name>``; or ``resource:room``, a room the
|
|
82
82
|
platform provisions for the enrollment (unitysvc/unitysvc#2830), whose
|
|
83
83
|
``kind`` (``chat``, ``support``, ``announcement``, ``discussion``) the
|
|
84
|
-
request fixes and whose permissions the kind bounds (:data:`ROOM_KINDS`)
|
|
84
|
+
request fixes and whose permissions the kind bounds (:data:`ROOM_KINDS`),
|
|
85
|
+
with optional caps on its members (``max_members``) and on how long it keeps
|
|
86
|
+
messages (``max_retention``, seconds); or
|
|
85
87
|
``apikey``: how long a key leased for the enrollment lives
|
|
86
88
|
(``limits.api_key_lifespan``, up to a day, with a justification), which grants
|
|
87
89
|
nothing. :func:`build_policy` turns a customer's approvals into the policy an
|
|
@@ -199,6 +201,10 @@ ROOM_KINDS: dict[str, frozenset[str]] = {
|
|
|
199
201
|
}
|
|
200
202
|
ROOM_KIND = "kind"
|
|
201
203
|
ROOM_MAX_MEMBERS = "max_members"
|
|
204
|
+
# The longest the provisioned room keeps messages, in seconds (0: never
|
|
205
|
+
# stored); the platform's own ceiling for the kind still applies, and the
|
|
206
|
+
# room's owner may keep less (unitysvc/unitysvc#2907).
|
|
207
|
+
ROOM_MAX_RETENTION = "max_retention"
|
|
202
208
|
RESOURCES: dict[str, Exports] = {
|
|
203
209
|
"room": Exports(
|
|
204
210
|
{name: () for name in ("create", "join", "read", "post")},
|
|
@@ -208,6 +214,7 @@ RESOURCES: dict[str, Exports] = {
|
|
|
208
214
|
"properties": {
|
|
209
215
|
ROOM_KIND: {"type": "string", "enum": list(ROOM_KINDS)},
|
|
210
216
|
ROOM_MAX_MEMBERS: {"type": "integer", "minimum": 1},
|
|
217
|
+
ROOM_MAX_RETENTION: {"type": "integer", "minimum": 0},
|
|
211
218
|
},
|
|
212
219
|
},
|
|
213
220
|
),
|
|
@@ -617,9 +624,10 @@ def check_resource(where: str, obj: str, permissions: list[str], options: dict[s
|
|
|
617
624
|
not allow, for a request and for a policy entry alike.
|
|
618
625
|
|
|
619
626
|
A room claim names its ``kind`` in its options; its permissions are some
|
|
620
|
-
of those the kind allows,
|
|
621
|
-
|
|
622
|
-
|
|
627
|
+
of those the kind allows, ``max_members`` (a positive integer) only caps
|
|
628
|
+
a room the customer creates, and ``max_retention`` (seconds, 0 or more)
|
|
629
|
+
caps how long any provisioned room keeps messages. A resource is
|
|
630
|
+
provisioned, not called, so it takes no limits.
|
|
623
631
|
"""
|
|
624
632
|
check_claim(where, obj, permissions, options, RESOURCES[obj.removeprefix(RESOURCE_PREFIX)])
|
|
625
633
|
if limits:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: unitysvc-core
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
4
4
|
Summary: Shared data models and validation helpers for UnitySVC packages
|
|
5
5
|
Author-email: Bo Peng <bo.peng@unitysvc.com>
|
|
6
6
|
Maintainer-email: Bo Peng <bo.peng@unitysvc.com>
|
|
@@ -214,7 +214,7 @@ Three stages (unitysvc/unitysvc#2720): a target service's **`exports`** (what it
|
|
|
214
214
|
- **A request's `options` are fixed.** Every option it declares is in the policy of an approved request, with the declared value; the customer may repeat it but not change or drop it. An option the request does not declare is the customer's to set at enrollment (a form rendered from the target's `options` schema). So `{"object": "service:ai", ...}` lets the customer pick the AI service, and `"options": "service=labs/llm-balanced"` pins it.
|
|
215
215
|
- Several requests may name one object (two kinds of room) only if each fixes some option to a different value (`kind=chat`, `kind=feed`), so an approval says which one it is.
|
|
216
216
|
- `limits` (`validate_limits`): `count_per_hour` / `count_per_day` / `count_per_month` / `count_total` (positive integer) and the same for `amount_` (finite positive decimal, as a number or a string). Limits are universal: the platform meters every call, so any service can be limited without exporting anything. The seller's limits only pre-fill the form; the customer sets them at enrollment, and an enrollment's own limits (unitysvc/unitysvc#2687) use the same shape. They are counted per policy entry (the enrollment's calls to that service) from the usage stream (counters keyed by scope, metric and window bucket), and the gateway refuses calls once one is exceeded.
|
|
217
|
-
- **A room the platform provisions** (unitysvc/unitysvc#2830) is asked for with `resource:room`: `{"object": "resource:room", "permissions": ["create"], "required": true, "justification": "Creates your chat room", "options": "kind=chat&max_members=100"}`. Core knows the resource, so no catalog is consulted. The request must fix `kind`, the room's identity; each kind bounds the permissions (`chat`: `create`, a room the customer owns; `support`: `join`, `read`, `post`, the seller's private room with the customer; `announcement`: `join`, `read`; `discussion`: `join`, `read`, `post`). `max_members` (a positive integer) caps only a room the customer creates. A channel requests each kind at most once, and a resource takes no limits.
|
|
217
|
+
- **A room the platform provisions** (unitysvc/unitysvc#2830) is asked for with `resource:room`: `{"object": "resource:room", "permissions": ["create"], "required": true, "justification": "Creates your chat room", "options": "kind=chat&max_members=100"}`. Core knows the resource, so no catalog is consulted. The request must fix `kind`, the room's identity; each kind bounds the permissions (`chat`: `create`, a room the customer owns; `support`: `join`, `read`, `post`, the seller's private room with the customer; `announcement`: `join`, `read`; `discussion`: `join`, `read`, `post`). `max_members` (a positive integer) caps only a room the customer creates; `max_retention` (seconds, 0 or more) caps how long any provisioned room keeps messages, within the platform's own ceiling for the kind, and the room's owner may keep less. A channel requests each kind at most once, and a resource takes no limits.
|
|
218
218
|
- **A longer-lived leased key** is asked for with one `apikey` entry: `{"object": "apikey", "required": false, "limits": {"api_key_lifespan": 14400}, "justification": "Batch runs take up to four hours"}`. It names the key itself, so it takes only `limits` (exactly `api_key_lifespan`, whole seconds from 1 to 86400), `required` and a `justification`, needs no catalog lookup, and grants nothing. Without it, a key the seller leases for the enrollment lives `DEFAULT_API_KEY_LIFESPAN` (3600 s). `api_key_lifespan` is valid only on this entry.
|
|
219
219
|
|
|
220
220
|
**3. How options reach the service.** Not through the upstream URL: the gateway never changes a target's `base_url` or query to carry policy. How an option is applied is up to the service's implementation:
|
|
@@ -831,8 +831,11 @@ def _resource(kind: str = "chat", permissions: list[str] | None = None, **fields
|
|
|
831
831
|
"entry",
|
|
832
832
|
[
|
|
833
833
|
_resource(options="kind=chat&max_members=100"),
|
|
834
|
+
_resource(options="kind=chat&max_retention=3600"),
|
|
835
|
+
_resource(options="kind=chat&max_retention=0"),
|
|
834
836
|
_resource(),
|
|
835
837
|
_resource("support", ["join", "read", "post"]),
|
|
838
|
+
_resource("support", ["join", "read", "post"], options="kind=support&max_retention=86400"),
|
|
836
839
|
_resource("announcement", ["join", "read"]),
|
|
837
840
|
_resource("discussion", ["join", "read", "post"]),
|
|
838
841
|
_resource("support", ["read"]),
|
|
@@ -874,6 +877,8 @@ def test_one_channel_may_request_several_kinds_of_room() -> None:
|
|
|
874
877
|
([_resource(options="kind=chat&max_members=0")], "max_members 0 is less than the minimum of 1"),
|
|
875
878
|
([_resource(options="kind=chat&max_members=many")], "max_members 'many' is not of type 'integer'"),
|
|
876
879
|
([_resource("support", ["join"], options="kind=support&max_members=5")], "only a room the customer creates"),
|
|
880
|
+
([_resource(options="kind=chat&max_retention=-1")], "max_retention -1 is less than the minimum of 0"),
|
|
881
|
+
([_resource(options="kind=chat&max_retention=soon")], "max_retention 'soon' is not of type 'integer'"),
|
|
877
882
|
([_resource(options="kind=chat&topic=x")], "accepts no option 'topic'"),
|
|
878
883
|
([_resource(limits={"count_per_day": 1})], "provisioned, not called; it takes no limits"),
|
|
879
884
|
([_resource(), _resource(options="kind=chat&max_members=5")], "kind=chat is listed twice"),
|
|
@@ -948,3 +953,23 @@ def test_a_customer_may_cap_their_own_room_when_the_request_leaves_it_open() ->
|
|
|
948
953
|
[_resource()], [{"object": "resource:room", "permissions": ["create"], "options": "max_members=8"}]
|
|
949
954
|
)
|
|
950
955
|
assert policy == [{"object": "resource:room", "permissions": ["create"], "options": "kind=chat&max_members=8"}]
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
def test_a_room_approval_keeps_the_requested_retention_cap() -> None:
|
|
959
|
+
"""The seller's ``max_retention`` (seconds) is the room's cap; an approval
|
|
960
|
+
carries it, and may not raise it (unitysvc/unitysvc#2907)."""
|
|
961
|
+
requested = [_resource(options="kind=chat&max_retention=3600")]
|
|
962
|
+
policy = build_policy(requested, [{"object": "resource:room", "permissions": ["create"], "options": "kind=chat"}])
|
|
963
|
+
assert policy == [{"object": "resource:room", "permissions": ["create"], "options": "kind=chat&max_retention=3600"}]
|
|
964
|
+
with pytest.raises(ValueError, match="max_retention: the service fixes it to '3600'"):
|
|
965
|
+
build_policy(
|
|
966
|
+
requested,
|
|
967
|
+
[{"object": "resource:room", "permissions": ["create"], "options": "kind=chat&max_retention=86400"}],
|
|
968
|
+
)
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
def test_a_customer_may_cap_their_own_rooms_retention_when_the_request_leaves_it_open() -> None:
|
|
972
|
+
policy = build_policy(
|
|
973
|
+
[_resource()], [{"object": "resource:room", "permissions": ["create"], "options": "max_retention=600"}]
|
|
974
|
+
)
|
|
975
|
+
assert policy == [{"object": "resource:room", "permissions": ["create"], "options": "kind=chat&max_retention=600"}]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|