refactor(api): move the server CDM licence cap into one module that measures tracks by the -q rule

This commit is contained in:
imSp4rky
2026-11-29 09:16:18 -07:00
parent 6fc2d84bd7
commit 8e67081e11
13 changed files with 318 additions and 168 deletions
+3 -14
View File
@@ -108,20 +108,9 @@ def test_the_named_services_are_the_global_list_else_every_keys_list():
assert api_keys({"users": users}) == ["a", "b", "c", "d"]
@pytest.mark.parametrize(
("setting", "service", "cap"),
[
(1080, "EXAMPLE1", 1080),
({"example1": 720, "default": 1080}, "EXAMPLE1", 720),
({"example1": 720, "default": 1080}, "EXAMPLE2", 1080),
({"EXAMPLE1": 1080}, "EXAMPLE2", None),
({"EXAMPLE1": None, "default": 1080}, "EXAMPLE1", 1080),
(None, "EXAMPLE1", None),
(True, "EXAMPLE1", None),
],
)
def test_the_height_cap_per_service(setting, service, cap):
assert KeyPolicy({"server_cdm_max_height": setting}).max_height(service) == cap
def test_the_policy_hands_over_the_cap_of_the_service():
policy = KeyPolicy({"server_cdm_max_height": {"example1": 720, "default": 1080}})
assert (policy.max_height("EXAMPLE1"), policy.max_height(None)) == (720, 1080)
def test_a_key_with_no_entry_gets_every_server_device():