mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-14 00:06:15 +01:00
tests.common: req.data can also be a file-like object
This commit is contained in:
parent
c53a7681ef
commit
502dbaa030
@ -93,8 +93,11 @@ class MyHTTPHandler(HTTPHandler):
|
||||
raise RuntimeError('exp or expfile required')
|
||||
if exp is not None:
|
||||
# use req.data instead of req.get_data() for python3 compatiblity
|
||||
if req.data != bytes(exp, "utf-8"):
|
||||
raise RequestDataMismatch(req.get_full_url(), repr(req.get_data()), repr(exp))
|
||||
data = req.data
|
||||
if hasattr(data, 'read'):
|
||||
data = data.read()
|
||||
if data != bytes(exp, "utf-8"):
|
||||
raise RequestDataMismatch(req.get_full_url(), repr(data), repr(exp))
|
||||
return self.__get_response(req.get_full_url(), **kwargs)
|
||||
|
||||
def __get_response(self, url, **kwargs):
|
||||
|
Loading…
Reference in New Issue
Block a user