a couple of fixes to make tests pass on win32

This commit is contained in:
Pablo Hoffman 2010-06-14 09:11:35 -03:00
parent 2d3d5b6aba
commit d8ac4857a5
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import os
import unittest
import urlparse
@ -147,7 +148,10 @@ class ResponseUtilsTest(unittest.TestCase):
url = "http:///www.example.com/some/page.html"
body = "<html> <head> <title>test page</title> </head> <body>test body</body> </html>"
def browser_open(burl):
bbody = open(urlparse.urlparse(burl).path).read()
path = urlparse.urlparse(burl).path
if not os.path.exists(path):
path = burl.replace('file://', '')
bbody = open(path).read()
assert '<base href="%s">' % url in bbody, "<base> tag not added"
return True
response = HtmlResponse(url, body=body)

View File

@ -67,6 +67,7 @@ def jsonrpc_server_call(target, jsonrpc_request, json_decoder=None):
params = req.get('params', [])
a, kw = ([], params) if isinstance(params, dict) else (params, {})
kw = dict([(str(k), v) for k, v in kw.items()]) # convert kw keys to str
try:
return jsonrpc_result(id, method(*a, **kw))
except Exception, e: