Commit 41a942a6 authored by Denis Bilenko's avatar Denis Bilenko

add TestClientCloses to test__http.py

parent 189b5f66
...@@ -64,6 +64,25 @@ class BoundTestCase(greentest.TestCase): ...@@ -64,6 +64,25 @@ class BoundTestCase(greentest.TestCase):
print 'WARNING: instead of ECONNREFUSED got IOError: %s' % e print 'WARNING: instead of ECONNREFUSED got IOError: %s' % e
class TestClientCloses(BoundTestCase):
spawn = True
def handle(self, r):
self.log.append('reply')
gevent.sleep(0.1)
r.send_reply(200, 'OK', 'hello world')
# QQQ should I get an exception here because the connection is closed?
self.log.append('reply_done')
def test(self):
self.log = ['hey']
s = self.connect()
s.sendall('GET / HTTP/1.1\r\nHost: localhost\r\nContent-Length: 100\r\n\r\n')
s.close()
gevent.sleep(0.2)
self.assertEqual(self.log, ['hey', 'reply', 'reply_done'])
class TestStop(BoundTestCase): class TestStop(BoundTestCase):
# this triggers if connection_closed is not handled properly # this triggers if connection_closed is not handled properly
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment