feat(access): add guarded local password lifecycle and recovery

This commit is contained in:
2026-09-08 07:47:18 +02:00
parent 8f8072b4ae
commit 7eb67b9fa7
31 changed files with 2377 additions and 33 deletions
+29 -4
View File
@@ -6,11 +6,36 @@ from govoplan_access.backend.manifest import manifest
class InterfaceDocumentationContractTests(unittest.TestCase):
def test_password_change_flag_is_documented_as_unenforced(self) -> None:
def test_password_f1_contexts_resolve_once_to_concise_bilingual_topics(self) -> None:
expected = {
"access.password.change": "access.help.password-change",
"access.password.recover": "access.help.password-recovery",
"access.password.issue-recovery": "access.help.password-issue-recovery",
}
for context, topic_id in expected.items():
with self.subTest(context=context):
matches = [topic for topic in manifest.documentation if context in (topic.metadata or {}).get("help_contexts", ())]
self.assertEqual([topic_id], [topic.id for topic in matches])
topic = matches[0]
self.assertEqual({"admin", "user"}, set(topic.documentation_types))
for body in (topic.body, topic.translations["de"]["body"]):
self.assertLessEqual(len(body.split()), 180)
self.assertIn("API", body)
self.assertIn("URLs", body)
if context != "access.password.change":
self.assertIn("15 minutes", topic.body)
self.assertIn("15 Minuten", topic.translations["de"]["body"])
def test_password_change_flag_documents_opt_in_and_complete_recovery(self) -> None:
topic = next(item for item in manifest.documentation if item.id == "access.reference.authentication-fields")
self.assertIn("currently advisory metadata", topic.body)
self.assertIn("server-side enforcement are not implemented", topic.body)
self.assertIn("serverseitige Durchsetzung sind noch nicht umgesetzt", topic.translations["de"]["body"])
self.assertIn("defaults to false", topic.body)
self.assertIn("remains advisory metadata", topic.body)
self.assertIn("standardmäßig false", topic.translations["de"]["body"])
recovery = next(item for item in manifest.documentation if item.id == "access.workflow.local-password-recovery")
for required in ("15 minutes", "single-use", "system:*", "human API keys", "e9a2c5f8b1d4", "does not send email"):
self.assertIn(required, recovery.body)
self.assertIn("issued by that account for other people", recovery.body)
self.assertIn("von diesem Konto für andere Personen ausgestellte", recovery.translations["de"]["body"])
def test_all_static_topics_have_complete_german_content(self) -> None:
for topic in manifest.documentation: