Permalink
Browse files

tests: Cover is_hybi00().

  • Loading branch information...
1 parent b20ef32 commit 46de521373f9cf094ad50a97fe3a19ff2d94c512 @MostAwesomeDude committed Nov 7, 2011
Showing with 16 additions and 3 deletions.
  1. +16 −3 tests.py
View
@@ -1,8 +1,8 @@
from twisted.trial import unittest
-from txws import (complete_hybi00, make_hybi00_frame, parse_hybi00_frames,
- http_headers, make_accept, mask, CLOSE, NORMAL, PING, PONG,
- parse_hybi07_frames)
+from txws import (is_hybi00, complete_hybi00, make_hybi00_frame,
+ parse_hybi00_frames, http_headers, make_accept, mask, CLOSE,
+ NORMAL, PING, PONG, parse_hybi07_frames)
class TestHTTPHeaders(unittest.TestCase):
@@ -55,6 +55,19 @@ def test_make_accept_wikipedia(self):
class TestHyBi00(unittest.TestCase):
+ def test_is_hybi00(self):
+ headers = {
+ "Sec-WebSocket-Key1": "hurp",
+ "Sec-WebSocket-Key2": "derp",
+ }
+ self.assertTrue(is_hybi00(headers))
+
+ def test_is_hybi00_false(self):
+ headers = {
+ "Sec-WebSocket-Key1": "hurp",
+ }
+ self.assertFalse(is_hybi00(headers))
+
def test_complete_hybi00_wikipedia(self):
"""
Test complete_hybi00() using the keys listed on Wikipedia's WebSockets

0 comments on commit 46de521

Please sign in to comment.