feat(docs): localize structured metadata and gate coverage
Module Package Release / publish-packages (push) Successful in 11s
Module Package Release / publish-packages (push) Successful in 11s
This commit is contained in:
@@ -52,6 +52,50 @@ class FakePrincipal:
|
||||
|
||||
|
||||
class DocsContextTests(unittest.TestCase):
|
||||
def test_structured_topic_metadata_uses_requested_locale(self) -> None:
|
||||
registry = PlatformRegistry()
|
||||
registry.register(
|
||||
ModuleManifest(
|
||||
id="example",
|
||||
name="Example",
|
||||
version="1.0.0",
|
||||
documentation=(
|
||||
DocumentationTopic(
|
||||
id="example.reference.localized",
|
||||
title="Reference",
|
||||
summary="Reference summary.",
|
||||
documentation_types=("admin",),
|
||||
metadata={
|
||||
"kind": "reference",
|
||||
"limitations": ["English limitation."],
|
||||
},
|
||||
structured_translation_version="1",
|
||||
structured_translations={
|
||||
"de": {
|
||||
"limitations": ["Deutsche Einschränkung."]
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
layers = _classify_documentation(
|
||||
registry,
|
||||
FakePrincipal({"docs:documentation:read"}),
|
||||
settings=None,
|
||||
session=None,
|
||||
documentation_type="admin",
|
||||
locale="de-DE",
|
||||
)
|
||||
|
||||
topic = layers["configured"][0]
|
||||
self.assertEqual("de", topic["structured_translation_locale"])
|
||||
self.assertEqual("1", topic["structured_translation_version"])
|
||||
self.assertEqual(
|
||||
["Deutsche Einschränkung."], topic["metadata"]["limitations"]
|
||||
)
|
||||
|
||||
def test_user_provider_state_omits_binding_details(self) -> None:
|
||||
state = {
|
||||
"configured": True,
|
||||
|
||||
Reference in New Issue
Block a user