fix: update 61 outdated test mocks to match current schemas
All checks were successful
CI/CD / go-lint (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Successful in 41s
CI/CD / test-python-backend-compliance (push) Successful in 31s
CI/CD / test-python-document-crawler (push) Successful in 21s
CI/CD / test-python-dsms-gateway (push) Successful in 16s
CI/CD / validate-canonical-controls (push) Successful in 10s
CI/CD / Deploy (push) Successful in 4s

Tests were failing due to stale mock objects after schema extensions:
- DSFA: add _mapping property to _DictRow, use proper mock instead of MagicMock
- Company Profile: add 6 missing fields (project_id, offering_urls, etc.)
- Legal Templates/Policy: update document type count 52→58
- VVT: add 13 missing attributes to activity mock
- Legal Documents: align consent test assertions with production behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-24 06:40:42 +01:00
parent 2efc738803
commit cce2707c03
7 changed files with 82 additions and 21 deletions

View File

@@ -121,7 +121,7 @@ class TestLegalTemplateSchemas:
assert d == {"status": "archived", "title": "Neue DSE"}
def test_valid_document_types_constant(self):
"""VALID_DOCUMENT_TYPES contains all 52 expected types (Migration 020+051+054)."""
"""VALID_DOCUMENT_TYPES contains all 58 expected types (Migration 020+051+054+056+073)."""
# Original types
assert "privacy_policy" in VALID_DOCUMENT_TYPES
assert "terms_of_service" in VALID_DOCUMENT_TYPES
@@ -153,8 +153,17 @@ class TestLegalTemplateSchemas:
assert "information_security_policy" in VALID_DOCUMENT_TYPES
assert "data_protection_policy" in VALID_DOCUMENT_TYPES
assert "business_continuity_policy" in VALID_DOCUMENT_TYPES
# Total: 16 original + 7 security concepts + 29 policies = 52
assert len(VALID_DOCUMENT_TYPES) == 52
# CRA Cybersecurity (Migration 056)
assert "cybersecurity_policy" in VALID_DOCUMENT_TYPES
# DSFA template
assert "dsfa" in VALID_DOCUMENT_TYPES
# Module document templates (Migration 073)
assert "vvt_register" in VALID_DOCUMENT_TYPES
assert "tom_documentation" in VALID_DOCUMENT_TYPES
assert "loeschkonzept" in VALID_DOCUMENT_TYPES
assert "pflichtenregister" in VALID_DOCUMENT_TYPES
# Total: 16 original + 7 security concepts + 29 policies + 1 CRA + 1 DSFA + 4 module docs = 58
assert len(VALID_DOCUMENT_TYPES) == 58
# Old names must NOT be present after rename
assert "data_processing_agreement" not in VALID_DOCUMENT_TYPES
assert "withdrawal_policy" not in VALID_DOCUMENT_TYPES
@@ -501,9 +510,9 @@ class TestLegalTemplateSeed:
class TestLegalTemplateNewTypes:
"""Validate new document types added in Migration 020."""
def test_all_52_types_present(self):
"""VALID_DOCUMENT_TYPES has exactly 52 entries (16 + 7 security + 29 policies)."""
assert len(VALID_DOCUMENT_TYPES) == 52
def test_all_58_types_present(self):
"""VALID_DOCUMENT_TYPES has exactly 58 entries (16 + 7 security + 29 policies + 1 CRA + 1 DSFA + 4 module docs)."""
assert len(VALID_DOCUMENT_TYPES) == 58
def test_new_types_are_valid(self):
"""All Migration 020 new types are accepted."""