refactor(vaults): pick kv vault behaviour from class flags and keep the api batch size

This commit is contained in:
imSp4rky
2026-11-27 12:10:07 -07:00
parent 84751b1f9e
commit cfe6685dfc
14 changed files with 212 additions and 26 deletions
+13
View File
@@ -7,6 +7,7 @@ from types import SimpleNamespace
from typing import Any
from uuid import UUID
import requests
from rich.table import Table
from unshackle.core.cdm.detect import cdm_type_stub
@@ -14,6 +15,18 @@ from unshackle.core.drm.key_resolution import ContentKeyResolver
from unshackle.core.vault import Vault
from unshackle.core.vaults import Vaults
PARKED_PAGE = b"<!DOCTYPE html><html><body>This domain may be for sale.</body></html>"
def fake_response(
status: int = 200, body: bytes = PARKED_PAGE, content_type: str = "text/html; charset=utf-8"
) -> requests.Response:
r = requests.Response()
r.status_code = status
r.headers["Content-Type"] = content_type
r._content = body
return r
class MemoryVault(Vault):
"""A key vault in memory that records each lookup in ``asked``, each push in ``pushes`` and ``added``, and each flag in ``told``."""