summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2012-01-08 12:50:06 -0500
committerChris McDonough <chrism@plope.com>2012-01-08 12:50:06 -0500
commit303526a9991e40366f3af6e3b5a12725a7755338 (patch)
tree08cb53288e7d5b115c6097f108d07e63ddb698bf /tests
parent046a5f8c3a67552b47b91c07dc40c6eb19f2f875 (diff)
downloadwebob-303526a9991e40366f3af6e3b5a12725a7755338.tar.gz
fix status_int/status bug on py3 (use explicit floor division), add coverage
Diffstat (limited to 'tests')
-rw-r--r--tests/test_response.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/test_response.py b/tests/test_response.py
index 1f9422c..8b62d81 100644
--- a/tests/test_response.py
+++ b/tests/test_response.py
@@ -1,6 +1,5 @@
import zlib
import io
-from hashlib import md5
from nose.tools import eq_, ok_, assert_raises
@@ -62,6 +61,34 @@ def test_set_response_status_binary():
assert res.status_int == 200
assert res.status == '200 OK'
+def test_set_response_status_str_no_reason():
+ req = BaseRequest.blank('/')
+ res = req.get_response(simple_app)
+ res.status = '200'
+ assert res.status_int == 200
+ assert res.status == '200 OK'
+
+def test_set_response_status_str_generic_reason():
+ req = BaseRequest.blank('/')
+ res = req.get_response(simple_app)
+ res.status = '299'
+ assert res.status_int == 299
+ assert res.status == '299 Success'
+
+def test_set_response_status_int():
+ req = BaseRequest.blank('/')
+ res = req.get_response(simple_app)
+ res.status_int = 200
+ assert res.status_int == 200
+ assert res.status == '200 OK'
+
+def test_set_response_status_int_generic_reason():
+ req = BaseRequest.blank('/')
+ res = req.get_response(simple_app)
+ res.status_int = 299
+ assert res.status_int == 299
+ assert res.status == '299 Success'
+
def test_content_type():
r = Response()
# default ctype and charset