# HG changeset patch # User Julien Cristau # Date 1358433729 -3600 # Node ID ce5ae7b80d2c8b91f8f5427a6f1cb9886f8b831e # Parent 64a400eea6dd4971e3ee41e9cca1c7b0038f55ec [devtools/httptest] allow sending other types of requests besides GET diff -r 64a400eea6dd -r ce5ae7b80d2c devtools/httptest.py --- a/devtools/httptest.py Fri Mar 08 18:43:42 2013 +0100 +++ b/devtools/httptest.py Thu Jan 17 15:42:09 2013 +0100 @@ -156,7 +156,7 @@ response = self.web_get('logout') self._ident_cookie = None - def web_get(self, path='', headers=None): + def web_request(self, path='', method='GET', body=None, headers=None) """Return an httplib.HTTPResponse object for the specified path Use available credential if available. @@ -166,12 +166,15 @@ if self._ident_cookie is not None: assert 'Cookie' not in headers headers['Cookie'] = self._ident_cookie - self._web_test_cnx.request("GET", '/' + path, headers=headers) + self._web_test_cnx.request(method, '/' + path, headers=headers, body=body) response = self._web_test_cnx.getresponse() response.body = response.read() # to chain request response.read = lambda : response.body return response + def web_get(self, path='', body=None, headers=None): + return self.web_request(path=path, body=body, headers=headers) + def setUp(self): super(CubicWebServerTC, self).setUp() self.start_server()