Exemplo n.º 1
0
 def test_read_write(self):
     self._listen()
     respond(self._server,'response')
     response = urllib.urlopen('http://localhost:%s/index.html' % 
                               self._port,'shane',5)
     data = response.read()
     self.failUnless(data == 'response','Wrong response returned: %s' % data)
Exemplo n.º 2
0
 def test_timeout(self):
     self._listen()
     try:
         response = urllib.urlopen('http://localhost:%s/index.html' % 
                                   self._port,None,1)
     except ETimeout:
         pass
     else:
         self.fail('Attempt to get response should have failed.')