Changeset 804
- Timestamp:
- 11/09/05 22:03:37
- Files:
-
- trunk/cherrypy/test/test_xmlrpc_filter.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/test/test_xmlrpc_filter.py
r778 r804 67 67 {'xmlRpcFilter.on':True} 68 68 }) 69 69 70 71 class ServerlessProxy(object): 72 """An xmlrpc proxy for the test suite's 'serverless' tests.""" 73 def __init__(self, webcase, url): 74 self._webcase = webcase 75 self.url = url 76 77 def __getattr__(self, attr, *args): 78 def xmlrpc_method(*args): 79 args = tuple(args) 80 body = xmlrpclib.dumps(args, attr) 81 cl = len(body) 82 headers = [('Content-Type', 'text/xml'), ('Content-Length', str(cl))] 83 self._webcase.getPage(self.url, headers=headers, method="POST", body=body) 84 return xmlrpclib.loads("".join(self._webcase.body))[0][0] 85 return xmlrpc_method 70 86 71 87 72 88 class XmlRpcFilterTest(helper.CPWebCase): 73 89 def testXmlRpcFilter(self): 74 75 proxy = xmlrpclib.ServerProxy('http://localhost:%s/xmlrpc/' % (self.PORT))76 90 91 # load the appropriate xmlrpc proxy 92 if cherrypy.server.httpserver is None: 93 proxy = ServerlessProxy(self, 'http://localhost:%s/xmlrpc/' % (self.PORT)) 94 else: 95 proxy = xmlrpclib.ServerProxy('http://localhost:%s/xmlrpc/' % (self.PORT)) 96 97 # begin the tests ... 77 98 self.assertEqual(proxy.return_single_item_list(), 78 99 [42] 100 ) 101 self.assertNotEqual(proxy.return_single_item_list(), 102 'one bazillion' 79 103 ) 80 104 self.assertEqual(proxy.return_string(),

