Skip to content

Commit

Permalink
Add test for websocket response with request larger than read BUFSIZE
Browse files Browse the repository at this point in the history
  • Loading branch information
spaceone committed Nov 4, 2016
1 parent 259c7e5 commit 5290d8c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/web/test_websockets.py
Expand Up @@ -6,7 +6,7 @@

from circuits import Component
from circuits.web.controllers import Controller
from circuits.net.sockets import close, write
from circuits.net.sockets import close, write, BUFSIZE
from circuits.web.websockets import WebSocketClient, WebSocketsDispatcher


Expand Down Expand Up @@ -81,6 +81,12 @@ def test(manager, watcher, webapp):
assert watcher.wait("read", channel="ws")
assert client.response == "Received: Hello!"

for size in (BUFSIZE, BUFSIZE + 1, BUFSZIE * 2):
data = "A" * (size + 1)
client.fire(write(data), "ws")
assert watcher.wait("read", channel="ws")
assert client.response == "Received: %s" % (data,)

f = urlopen(webapp.server.http.base)
s = f.read()
assert s == b"Hello World!"
Expand Down

0 comments on commit 5290d8c

Please sign in to comment.