Skip to content

Commit 1c8a8e3

Browse files
committed
Tests: make input schemas strict when using mashmallow 2
1 parent fea513b commit 1c8a8e3

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/test_blueprint.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
from flask_smorest import Api, Blueprint, Page
1414
from flask_smorest.fields import Upload
15+
from flask_smorest.compat import MARSHMALLOW_VERSION_MAJOR
16+
1517

1618
from .utils import build_ref
1719

@@ -289,6 +291,9 @@ def test_blueprint_arguments_files_multipart(
289291
client = app.test_client()
290292

291293
class MultipartSchema(ma.Schema):
294+
if MARSHMALLOW_VERSION_MAJOR < 3:
295+
class Meta:
296+
strict = True
292297
file_1 = Upload()
293298
file_2 = Upload()
294299

@@ -747,6 +752,9 @@ def test_blueprint_doc_merged_after_prepare_doc(self, app):
747752
'content': {'application/json': {'example': {'test': 123}}}}
748753

749754
class ItemSchema(ma.Schema):
755+
if MARSHMALLOW_VERSION_MAJOR < 3:
756+
class Meta:
757+
strict = True
750758
test = ma.fields.Int()
751759

752760
@blp.route('/')
@@ -778,6 +786,9 @@ def test_blueprint_response_status_code_cast_to_string(
778786
doc_desc = {'description': 'Description'}
779787

780788
class ItemSchema(ma.Schema):
789+
if MARSHMALLOW_VERSION_MAJOR < 3:
790+
class Meta:
791+
strict = True
781792
test = ma.fields.Int()
782793

783794
@blp.route('/')

0 commit comments

Comments
 (0)