Exemple #1
0
 def test_construct(self):
     self.startServer()
     url = self.getURL()
     cli = http_client.HTTPClientBase(url)
     self.assertEqual(url, cli._url.geturl())
     self.assertIs(None, cli._conn)
Exemple #2
0
 def test_parse_url(self):
     cli = http_client.HTTPClientBase('http://127.0.0.1:12345/')
     self.assertEqual('http', cli._url.scheme)
     self.assertEqual('127.0.0.1', cli._url.hostname)
     self.assertEqual(12345, cli._url.port)
     self.assertEqual('/', cli._url.path)
Exemple #3
0
 def getClient(self, **kwds):
     self.startServer()
     return http_client.HTTPClientBase(self.getURL('dbase'), **kwds)
Exemple #4
0
 def _request(self, port, path):
     url = "http://127.0.0.1:%s%s" % (port, path)
     c = http_client.HTTPClientBase(url)
     self.addCleanup(c.close)
     return c._request_json('GET', [])