Skip to content

Commit 1be4994

Browse files
author
Khizar Alam
committed
Fix cookie header key issue, add a function to compare dictionaries in robot tests
1 parent 7014d2b commit 1be4994

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/HttpLibrary/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,15 @@ def response_body_should_contain(self, should_contain):
516516
'"%s" should have contained "%s", but did not.' % (
517517
self.response.body, should_contain)
518518

519+
def json_data_body_should_contain(self,should_contain):
520+
521+
response = load_json(self.response.body)['data']
522+
should_contain_json = load_json(should_contain)
523+
assert should_contain_json in response, \
524+
'"%s" should have contained "%s", but did not.' % (
525+
response, should_contain_json)
526+
527+
519528
def log_response_body(self, log_level='INFO'):
520529
"""
521530
Logs the response body.

src/HttpLibrary/livetest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
3636
"""
3737

38+
from __future__ import unicode_literals
3839
from future import standard_library
3940
standard_library.install_aliases()
4041
from builtins import object
@@ -130,7 +131,12 @@ def __init__(self, host, scheme='http', relative_to=None):
130131

131132
def _do_httplib_request(self, req):
132133
"Convert WebOb Request to httplib request."
133-
headers = dict((name, val) for name, val in req.headers.items())
134+
headers = {}
135+
136+
for name, val in req.headers.items():
137+
if sys.version_info[0]==2 and isinstance(name, unicode):
138+
name = str(name)
139+
headers[name] = val
134140
if req.scheme not in self.conn:
135141
self._load_conn(req.scheme)
136142

0 commit comments

Comments
 (0)