Skip to content

Commit ecb33a8

Browse files
committed
fix: fix marshmallow warning about using kwargs arguments to declare fields
Turns out this was a typo and MultiScanResultSchema did not validate that scan_results was not empty, causing one test to fail. Updated the test.
1 parent a95b287 commit ecb33a8

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

pygitguardian/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ class MultiScanResultSchema(BaseSchema):
324324
scan_results = fields.List(
325325
fields.Nested(ScanResultSchema),
326326
required=True,
327-
validates=validate.Length(min=1),
327+
validate=validate.Length(min=1),
328328
)
329329

330330
@post_load

tests/test_models.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,27 @@ def test_document_model(self):
4545
(
4646
MultiScanResultSchema,
4747
MultiScanResult,
48-
{"scan_results": [], "type": "hello"},
48+
{
49+
"scan_results": [
50+
{
51+
"policy_break_count": 1,
52+
"policies": ["pol"],
53+
"policy_breaks": [
54+
{
55+
"type": "break",
56+
"policy": "mypol",
57+
"matches": [
58+
{
59+
"match": "hello",
60+
"type": "hello",
61+
}
62+
],
63+
}
64+
],
65+
}
66+
],
67+
"type": "hello",
68+
},
4969
),
5070
(
5171
PolicyBreakSchema,

0 commit comments

Comments
 (0)