Skip to content

Commit f3c0516

Browse files
committed
tests(serializer): ensure internal fields are removed
1 parent b5aa66f commit f3c0516

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/unit/test_serializer.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,19 @@ def test_cds_json_serializer_sanitization(video_record_metadata):
173173
'title': {'title': '<script>alert("bad")</script> Titre'}
174174
}
175175
]
176+
177+
record["_access"] = {
178+
"key": "value"
179+
}
180+
record["_buckets"] = {
181+
"key":"value"
182+
}
183+
record["_cds"] = {
184+
"key":"value"
185+
}
186+
record["_deposit"] = {
187+
"key":"value"
188+
}
176189

177190
# Test the serializer
178191
serializer = CDSJSONSerializer()
@@ -201,3 +214,8 @@ def test_cds_json_serializer_sanitization(video_record_metadata):
201214
translations = result['metadata']['translations']
202215
for tr in translations:
203216
assert '<script>' not in tr['description']
217+
218+
assert "_access" not in record
219+
assert "_buckets" not in record
220+
assert "_cds" not in record
221+
assert "_deposit" not in record

0 commit comments

Comments
 (0)