unitysvc-core 0.3.1__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.
- {unitysvc_core-0.3.1/src/unitysvc_core.egg-info → unitysvc_core-0.3.2}/PKG-INFO +2 -1
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/README.md +1 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/pyproject.toml +1 -1
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/grants.py +15 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/parameter_usage.py +21 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2/src/unitysvc_core.egg-info}/PKG-INFO +2 -1
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_grants.py +19 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_parameter_usage.py +84 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/LICENSE +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/setup.cfg +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/__init__.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/__init__.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/base.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/channel.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/documents.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/listing_data.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/listing_v1.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/offering_data.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/offering_v1.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/pricing.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/promotion_data.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/provider_data.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/provider_v1.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/service.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/service_group_data.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/models/validators.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/py.typed +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/schema/base.json +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/schema/listing_v1.json +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/schema/offering_v1.json +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/schema/promotion_v1.json +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/schema/provider_v1.json +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/schema/service_group_v1.json +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/utils.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core/validator.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core.egg-info/SOURCES.txt +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core.egg-info/dependency_links.txt +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core.egg-info/requires.txt +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/src/unitysvc_core.egg-info/top_level.txt +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_access_interface_routing.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_canonical_interfaces.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_channel.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_effective_price.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_hidden_path_skip.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_listing_audience.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_offering_data.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_pricing.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_provider_account_rate_limits.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_service_group.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_service_status.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_utils.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_validate_service.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/tests/test_validator.py +0 -0
- {unitysvc_core-0.3.1 → unitysvc_core-0.3.2}/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.2
|
|
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>
|
|
@@ -288,5 +288,6 @@ A channel declares the enrollment parameters it reads, so each plan of a service
|
|
|
288
288
|
`params.schema` is a JSON Schema of the parameters (a property's own `default` pre-fills the customer's form), `params.ui_schema` holds form hints, and `params.testing_defaults` holds the values the platform tests the channel with. Rules:
|
|
289
289
|
|
|
290
290
|
- a channel reads only the parameters its `params.schema` declares, and a channel that reads `{{ params.* }}` must declare `params` (`validate_channel_parameters`, on every `offering_v1`);
|
|
291
|
+
- `params.schema` is a valid, self-contained JSON Schema (draft 7, no `$ref`), and `params.testing_defaults` validates against it with format checking (an `email` property needs an email address), so a malformed schema is refused at ingest rather than when a customer enrolls;
|
|
291
292
|
- each required parameter has a value in that channel's `params.testing_defaults`, which is also what `${ customer_secrets.{{ params.X }} }` renders with when secret references are checked;
|
|
292
293
|
- each required parameter is read by its own channel or by document content (`validate_required_parameter_usage`, which backend ingest also calls).
|
|
@@ -253,5 +253,6 @@ A channel declares the enrollment parameters it reads, so each plan of a service
|
|
|
253
253
|
`params.schema` is a JSON Schema of the parameters (a property's own `default` pre-fills the customer's form), `params.ui_schema` holds form hints, and `params.testing_defaults` holds the values the platform tests the channel with. Rules:
|
|
254
254
|
|
|
255
255
|
- a channel reads only the parameters its `params.schema` declares, and a channel that reads `{{ params.* }}` must declare `params` (`validate_channel_parameters`, on every `offering_v1`);
|
|
256
|
+
- `params.schema` is a valid, self-contained JSON Schema (draft 7, no `$ref`), and `params.testing_defaults` validates against it with format checking (an `email` property needs an email address), so a malformed schema is refused at ingest rather than when a customer enrolls;
|
|
256
257
|
- each required parameter has a value in that channel's `params.testing_defaults`, which is also what `${ customer_secrets.{{ params.X }} }` renders with when secret references are checked;
|
|
257
258
|
- each required parameter is read by its own channel or by document content (`validate_required_parameter_usage`, which backend ingest also calls).
|
|
@@ -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.2"
|
|
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" }]
|
|
@@ -123,6 +123,10 @@ INVOKE = "invoke"
|
|
|
123
123
|
# The key itself: a request for a longer-lived leased key, and the approved
|
|
124
124
|
# lifespan in a policy. It grants nothing.
|
|
125
125
|
APIKEY_OBJECT = "apikey"
|
|
126
|
+
# Every service at once. It belongs to keys a customer creates by hand: a
|
|
127
|
+
# policy derived from an enrollment names each service it calls
|
|
128
|
+
# (unitysvc/unitysvc#2783), so no request or approval may hold it.
|
|
129
|
+
SERVICE_WILDCARD = "service:*"
|
|
126
130
|
API_KEY_LIFESPAN = "api_key_lifespan"
|
|
127
131
|
# Seconds a leased key lives unless the policy says otherwise, and at most.
|
|
128
132
|
DEFAULT_API_KEY_LIFESPAN = 3600
|
|
@@ -406,6 +410,8 @@ def validate_access_requests(where: str, requests: Any, resolve: ExportsResolver
|
|
|
406
410
|
seen.add(obj)
|
|
407
411
|
_check_apikey_request(at, entry)
|
|
408
412
|
continue
|
|
413
|
+
if obj == SERVICE_WILDCARD:
|
|
414
|
+
raise ValueError(_service_wildcard_refusal(at, "requested"))
|
|
409
415
|
if not obj.startswith(SERVICE_PREFIX):
|
|
410
416
|
raise ValueError(f"{at}: {obj!r} cannot be requested; name one service as 'service:<name>'")
|
|
411
417
|
name = obj.removeprefix(SERVICE_PREFIX)
|
|
@@ -438,6 +444,13 @@ def validate_access_requests(where: str, requests: Any, resolve: ExportsResolver
|
|
|
438
444
|
check_claim(at, obj, permissions, options, parse_exports(f"{obj} exports", declared))
|
|
439
445
|
|
|
440
446
|
|
|
447
|
+
def _service_wildcard_refusal(at: str, verb: str) -> str:
|
|
448
|
+
return (
|
|
449
|
+
f"{at}: {SERVICE_WILDCARD!r} cannot be {verb}: every service at once is only for keys "
|
|
450
|
+
"a customer creates by hand; name each service as 'service:<name>'"
|
|
451
|
+
)
|
|
452
|
+
|
|
453
|
+
|
|
441
454
|
def _check_apikey_request(at: str, entry: dict[str, Any]) -> None:
|
|
442
455
|
"""The ``apikey`` request: how long a leased key should live, with why."""
|
|
443
456
|
if extra := set(entry) - _APIKEY_REQUEST_KEYS:
|
|
@@ -509,6 +522,8 @@ def build_policy(requests: Any, approvals: Any, resolve: ExportsResolver | None
|
|
|
509
522
|
if not isinstance(approval, dict) or not isinstance(approval.get("object"), str):
|
|
510
523
|
raise ValueError(f'{at} must be {{"object": ..., "permissions": [...]}}')
|
|
511
524
|
obj = approval["object"]
|
|
525
|
+
if obj == SERVICE_WILDCARD:
|
|
526
|
+
raise ValueError(_service_wildcard_refusal(at, "approved"))
|
|
512
527
|
if obj == ENROLLMENT_OBJECT:
|
|
513
528
|
if any(entry["object"] == obj for entry in policy):
|
|
514
529
|
raise ValueError(f"{at}: {obj} is listed twice")
|
|
@@ -5,6 +5,8 @@ declares none. Checks shared by seller validation and backend ingest:
|
|
|
5
5
|
|
|
6
6
|
- a channel reads only parameters it declares, and declares ``params`` if it
|
|
7
7
|
reads any;
|
|
8
|
+
- ``params.schema`` is a self-contained JSON Schema (draft 7), and
|
|
9
|
+
``params.testing_defaults`` validates against it;
|
|
8
10
|
- every required parameter has a value in ``params.testing_defaults``;
|
|
9
11
|
- every required parameter is read by its channel or by document content.
|
|
10
12
|
|
|
@@ -17,6 +19,10 @@ reference there does not count (unitysvc/unitysvc#2649).
|
|
|
17
19
|
from typing import Any
|
|
18
20
|
|
|
19
21
|
from jinja2 import Environment, TemplateSyntaxError, nodes
|
|
22
|
+
from jsonschema import Draft7Validator
|
|
23
|
+
from jsonschema.exceptions import SchemaError
|
|
24
|
+
|
|
25
|
+
from .grants import _find_reference
|
|
20
26
|
|
|
21
27
|
_ENV = Environment()
|
|
22
28
|
|
|
@@ -156,6 +162,16 @@ def validate_channel_parameters(offering: dict[str, Any]) -> list[str]:
|
|
|
156
162
|
if not isinstance(schema, dict):
|
|
157
163
|
errors.append(f"{at}.schema must be a JSON Schema object")
|
|
158
164
|
continue
|
|
165
|
+
schema_ok = True
|
|
166
|
+
if ref := _find_reference(schema):
|
|
167
|
+
errors.append(f"{at}.schema: {ref!r} is not allowed; a params schema is self-contained")
|
|
168
|
+
schema_ok = False
|
|
169
|
+
else:
|
|
170
|
+
try:
|
|
171
|
+
Draft7Validator.check_schema(schema)
|
|
172
|
+
except SchemaError as exc:
|
|
173
|
+
errors.append(f"{at}.schema is not a valid JSON Schema: {exc.message}")
|
|
174
|
+
schema_ok = False
|
|
159
175
|
ui_schema = params.get("ui_schema")
|
|
160
176
|
if ui_schema is not None and not isinstance(ui_schema, dict):
|
|
161
177
|
errors.append(f"{at}.ui_schema must be an object")
|
|
@@ -173,6 +189,11 @@ def validate_channel_parameters(offering: dict[str, Any]) -> list[str]:
|
|
|
173
189
|
f"{where}: required parameter(s) {', '.join(missing)} need a value in "
|
|
174
190
|
f"{at}.testing_defaults, used to test the channel"
|
|
175
191
|
)
|
|
192
|
+
elif schema_ok:
|
|
193
|
+
validator = Draft7Validator(schema, format_checker=Draft7Validator.FORMAT_CHECKER)
|
|
194
|
+
for error in sorted(validator.iter_errors(defaults or {}), key=lambda e: [str(p) for p in e.path]):
|
|
195
|
+
path = "".join(f".{p}" for p in error.path)
|
|
196
|
+
errors.append(f"{at}.testing_defaults{path}: {error.message}")
|
|
176
197
|
return errors
|
|
177
198
|
|
|
178
199
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: unitysvc-core
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
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>
|
|
@@ -288,5 +288,6 @@ A channel declares the enrollment parameters it reads, so each plan of a service
|
|
|
288
288
|
`params.schema` is a JSON Schema of the parameters (a property's own `default` pre-fills the customer's form), `params.ui_schema` holds form hints, and `params.testing_defaults` holds the values the platform tests the channel with. Rules:
|
|
289
289
|
|
|
290
290
|
- a channel reads only the parameters its `params.schema` declares, and a channel that reads `{{ params.* }}` must declare `params` (`validate_channel_parameters`, on every `offering_v1`);
|
|
291
|
+
- `params.schema` is a valid, self-contained JSON Schema (draft 7, no `$ref`), and `params.testing_defaults` validates against it with format checking (an `email` property needs an email address), so a malformed schema is refused at ingest rather than when a customer enrolls;
|
|
291
292
|
- each required parameter has a value in that channel's `params.testing_defaults`, which is also what `${ customer_secrets.{{ params.X }} }` renders with when secret references are checked;
|
|
292
293
|
- each required parameter is read by its own channel or by document content (`validate_required_parameter_usage`, which backend ingest also calls).
|
|
@@ -589,6 +589,25 @@ def test_a_request_never_names_an_enrollment() -> None:
|
|
|
589
589
|
validate_access_requests(_WHERE, [_dep("service:me", enrollment="JYY87Y")])
|
|
590
590
|
|
|
591
591
|
|
|
592
|
+
@pytest.mark.parametrize(
|
|
593
|
+
"entry",
|
|
594
|
+
[
|
|
595
|
+
_dep("service:*"),
|
|
596
|
+
{"object": "service:*", "permissions": ["deny"], "justification": "x"},
|
|
597
|
+
{"object": "service:*", "permissions": ["invoke"], "justification": "x", "limits": {"count_per_day": 1}},
|
|
598
|
+
],
|
|
599
|
+
)
|
|
600
|
+
def test_service_wildcard_is_refused_by_rule(entry: dict[str, Any]) -> None:
|
|
601
|
+
"""unitysvc/unitysvc#2783: service:* in any form is for manually created keys."""
|
|
602
|
+
with pytest.raises(ValueError, match=r"'service:\*' cannot be requested: every service at once is only for keys"):
|
|
603
|
+
validate_access_requests(_WHERE, [entry])
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
def test_service_wildcard_is_never_approved() -> None:
|
|
607
|
+
with pytest.raises(ValueError, match=r"'service:\*' cannot be approved: every service at once"):
|
|
608
|
+
build_policy(_REQUESTS, [{"object": "service:*", "permissions": ["invoke"]}], _resolve)
|
|
609
|
+
|
|
610
|
+
|
|
592
611
|
def test_a_seller_cannot_request_the_enrollment_entry() -> None:
|
|
593
612
|
with pytest.raises(ValueError, match="cannot be requested"):
|
|
594
613
|
validate_access_requests(_WHERE, [{"object": "enrollment", "justification": "x", "limits": {"count_total": 1}}])
|
|
@@ -271,6 +271,90 @@ def test_malformed_channel_declarations_are_refused(fields, error):
|
|
|
271
271
|
assert any(error in e for e in validate_channel_parameters(_offering(plus=_plus(**fields))))
|
|
272
272
|
|
|
273
273
|
|
|
274
|
+
@pytest.mark.parametrize(
|
|
275
|
+
("schema", "error"),
|
|
276
|
+
[
|
|
277
|
+
(
|
|
278
|
+
{"type": "nope"},
|
|
279
|
+
"upstream_access_config.plus.params.schema is not a valid JSON Schema: 'nope' is not valid",
|
|
280
|
+
),
|
|
281
|
+
(
|
|
282
|
+
{"type": "object", "properties": {"folder": {"type": "string"}}, "required": "folder"},
|
|
283
|
+
"upstream_access_config.plus.params.schema is not a valid JSON Schema: 'folder' is not of type 'array'",
|
|
284
|
+
),
|
|
285
|
+
(
|
|
286
|
+
{"type": "object", "properties": {"folder": {"$ref": "https://example.com/s.json"}}},
|
|
287
|
+
"upstream_access_config.plus.params.schema: '$ref' is not allowed; a params schema is self-contained",
|
|
288
|
+
),
|
|
289
|
+
],
|
|
290
|
+
)
|
|
291
|
+
def test_an_invalid_params_schema_is_refused(schema, error):
|
|
292
|
+
errors = validate_channel_parameters(_offering(plus=_plus(schema=schema)))
|
|
293
|
+
assert any(e.startswith(error) for e in errors), errors
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
_TYPED_SCHEMA = {
|
|
297
|
+
"type": "object",
|
|
298
|
+
"properties": {
|
|
299
|
+
"folder": {"type": "string"},
|
|
300
|
+
"count": {"type": "integer"},
|
|
301
|
+
"tier": {"type": "string", "enum": ["basic", "plus"]},
|
|
302
|
+
"contact": {"type": "string", "format": "email"},
|
|
303
|
+
},
|
|
304
|
+
"required": ["folder"],
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
@pytest.mark.parametrize(
|
|
309
|
+
("defaults", "error"),
|
|
310
|
+
[
|
|
311
|
+
(
|
|
312
|
+
{"count": "three"},
|
|
313
|
+
"upstream_access_config.plus.params.testing_defaults.count: 'three' is not of type 'integer'",
|
|
314
|
+
),
|
|
315
|
+
({"tier": "gold"}, "upstream_access_config.plus.params.testing_defaults.tier: 'gold' is not one of"),
|
|
316
|
+
(
|
|
317
|
+
{"contact": "nobody"},
|
|
318
|
+
"upstream_access_config.plus.params.testing_defaults.contact: 'nobody' is not a 'email'",
|
|
319
|
+
),
|
|
320
|
+
],
|
|
321
|
+
)
|
|
322
|
+
def test_testing_defaults_must_validate_against_the_schema(defaults, error):
|
|
323
|
+
params = {"schema": _TYPED_SCHEMA, "testing_defaults": {"folder": "ops", **defaults}}
|
|
324
|
+
errors = validate_channel_parameters(
|
|
325
|
+
_offering(plus={"base_url": "https://u/{{ params.folder }}", "params": params})
|
|
326
|
+
)
|
|
327
|
+
assert len(errors) == 1, errors
|
|
328
|
+
assert errors[0].startswith(error), errors
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
def test_testing_defaults_report_one_error_per_problem():
|
|
332
|
+
defaults = {"folder": "ops", "count": "three", "tier": "gold", "contact": "nobody"}
|
|
333
|
+
params = {"schema": _TYPED_SCHEMA, "testing_defaults": defaults}
|
|
334
|
+
errors = validate_channel_parameters(
|
|
335
|
+
_offering(plus={"base_url": "https://u/{{ params.folder }}", "params": params})
|
|
336
|
+
)
|
|
337
|
+
assert [e.split(":")[0] for e in errors] == [
|
|
338
|
+
"upstream_access_config.plus.params.testing_defaults.contact",
|
|
339
|
+
"upstream_access_config.plus.params.testing_defaults.count",
|
|
340
|
+
"upstream_access_config.plus.params.testing_defaults.tier",
|
|
341
|
+
]
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
def test_valid_testing_defaults_pass():
|
|
345
|
+
defaults = {"folder": "ops", "count": 3, "tier": "plus", "contact": "ops@example.com"}
|
|
346
|
+
params = {"schema": _TYPED_SCHEMA, "testing_defaults": defaults}
|
|
347
|
+
assert (
|
|
348
|
+
validate_channel_parameters(_offering(plus={"base_url": "https://u/{{ params.folder }}", "params": params}))
|
|
349
|
+
== []
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
def test_a_channel_without_params_is_unaffected():
|
|
354
|
+
offering = _offering(byok={"base_url": "https://u", "api_key": "${ customer_secrets.KEY }"})
|
|
355
|
+
assert validate_channel_parameters(offering) == []
|
|
356
|
+
|
|
357
|
+
|
|
274
358
|
def test_params_must_be_an_object():
|
|
275
359
|
errors = validate_channel_parameters(_offering(plus={"base_url": "https://u", "params": ["folder"]}))
|
|
276
360
|
assert any('params must be {"schema"' in e for e in errors), errors
|
|
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
|