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
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:
@@ -57,8 +57,21 @@ TENANT_ID = "default"
|
||||
|
||||
|
||||
class _DictRow(dict):
|
||||
"""Dict wrapper that mimics PostgreSQL's dict-like row access for SQLite."""
|
||||
pass
|
||||
"""Dict wrapper that mimics PostgreSQL's dict-like row access for SQLite.
|
||||
|
||||
Provides a ``_mapping`` property (returns self) so that production code
|
||||
such as ``row._mapping["id"]`` works, and supports integer indexing via
|
||||
``row[0]`` which returns the first value (used as fallback in create_dsfa).
|
||||
"""
|
||||
|
||||
@property
|
||||
def _mapping(self):
|
||||
return self
|
||||
|
||||
def __getitem__(self, key):
|
||||
if isinstance(key, int):
|
||||
return list(self.values())[key]
|
||||
return super().__getitem__(key)
|
||||
|
||||
|
||||
class _DictSession:
|
||||
@@ -512,9 +525,7 @@ class TestDsfaToResponse:
|
||||
"metadata": {},
|
||||
}
|
||||
defaults.update(overrides)
|
||||
row = MagicMock()
|
||||
row.__getitem__ = lambda self, key: defaults[key]
|
||||
return row
|
||||
return _DictRow(defaults)
|
||||
|
||||
def test_basic_fields(self):
|
||||
row = self._make_row()
|
||||
@@ -629,7 +640,7 @@ class TestDSFARouterConfig:
|
||||
assert "compliance-dsfa" in dsfa_router.tags
|
||||
|
||||
def test_router_registered_in_init(self):
|
||||
from compliance.api import dsfa_router as imported_router
|
||||
from compliance.api.dsfa_routes import router as imported_router
|
||||
assert imported_router is not None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user