forked from plangrid/flask-rebar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
!chg: Remove Flask-Testing dependency and drop Python 3.4 support. (p…
…langrid#173) * Remove Flask-Testing dependency. * Added JsonResponseMixin from Flask-Testing which we need as long as we continue to test flask<1.0 * Pinned Werkzueg in travis. Should be able to drop if we drop flask<0.12 support. * Dropped support for python 3.4 in order to test support for Werkzeug 1.0.0
- Loading branch information
1 parent
58c7023
commit 20076f6
Showing
6 changed files
with
59 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,30 @@ | ||
import unittest | ||
from flask_rebar.compat import MARSHMALLOW_V2, MARSHMALLOW_V3 | ||
from flask import json_available | ||
|
||
if json_available: | ||
from flask import json | ||
from werkzeug.utils import cached_property | ||
|
||
skip_if_marshmallow_not_v2 = unittest.skipIf( | ||
not MARSHMALLOW_V2, reason="Only applicable for Marshmallow version 2" | ||
) | ||
skip_if_marshmallow_not_v3 = unittest.skipIf( | ||
not MARSHMALLOW_V3, reason="Only applicable for Marshmallow version 3" | ||
) | ||
|
||
|
||
class JsonResponseMixin(object): | ||
""" | ||
Mixin with testing helper methods | ||
""" | ||
|
||
@cached_property | ||
def json(self): | ||
if not json_available: # pragma: no cover | ||
raise NotImplementedError | ||
return json.loads(self.data) | ||
|
||
|
||
def make_test_response(response_class): | ||
return type("TestResponse", (response_class, JsonResponseMixin), {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters