summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGael Pasgrimaud <gael@gawel.org>2014-04-17 17:24:44 +0200
committerGael Pasgrimaud <gael@gawel.org>2014-04-17 17:24:44 +0200
commitcd44e874224879a78dd0209b77f8bfd7222ac5da (patch)
tree45b3a04b5a131122acfba7d57a75ac55a210eff3
parent9fed8a51b904919626511a3b4f5eacf1cbd30970 (diff)
downloadwebtest-cd44e874224879a78dd0209b77f8bfd7222ac5da.tar.gz
Fixed #106. added a few documentation
-rw-r--r--CHANGELOG.rst3
-rw-r--r--webtest/app.py16
2 files changed, 16 insertions, 3 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 4e3cf86..0d478c5 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -20,6 +20,9 @@ News
- Fixed #103 Broken "Edit me on GitHub" links in documentation
[gawel]
+- Fixed #106 Make wrapping the app in the lint middleware optional
+ [dmlayton]
+
- Fixed #107 Explicit error message when WSGIProxy2 is not installer
[gawel]
diff --git a/webtest/app.py b/webtest/app.py
index 029d63c..d0b8abb 100644
--- a/webtest/app.py
+++ b/webtest/app.py
@@ -111,14 +111,21 @@ class TestApp(object):
Passed to BeautifulSoup when parsing responses.
:type parser_features:
string or list
+ :param json_encoder:
+ Passed to json.dumps when encoding json
+ :type json_encoder:
+ A subclass of json.JSONEncoder
+ :param lint:
+ If True (default) then check that the application is WSGI compliant
+ :type lint:
+ A boolean
"""
RequestClass = TestRequest
- JSONEncoder = json.JSONEncoder
-
def __init__(self, app, extra_environ=None, relative_to=None,
- use_unicode=True, cookiejar=None, parser_features=None, lint=True):
+ use_unicode=True, cookiejar=None, parser_features=None,
+ json_encoder=None, lint=True):
if 'WEBTEST_TARGET_URL' in os.environ:
app = os.environ['WEBTEST_TARGET_URL']
if isinstance(app, string_types):
@@ -150,6 +157,9 @@ class TestApp(object):
if parser_features is None:
parser_features = 'html.parser'
self.RequestClass.ResponseClass.parser_features = parser_features
+ if json_encoder is None:
+ json_encoder = json.JSONEncoder
+ self.JSONEncoder = json_encoder
def get_authorization(self):
"""Allow to set the HTTP_AUTHORIZATION environ key. Value should looks