From aa8f714a48ca7eb2dcf59e9345da1361ba215e61 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 18 Apr 2016 23:49:11 -0700 Subject: [PATCH] websocket: change 'all-channelids' to 'channelids' Yeah, names are easier to work with when they're also valid identifiers. --- src/wormhole_server/rendezvous_websocket.py | 6 +++--- tests/test_server.py | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/wormhole_server/rendezvous_websocket.py b/src/wormhole_server/rendezvous_websocket.py index b640a54..b541e14 100644 --- a/src/wormhole_server/rendezvous_websocket.py +++ b/src/wormhole_server/rendezvous_websocket.py @@ -27,8 +27,8 @@ from autobahn.twisted import websocket # motd: all clients display message, then continue normally # error: all clients display mesage, then terminate with error # -> {type: "bind", appid:, side:} -# -> {type: "list"} -> all-channelids -# <- {type: "all-channelids", channelids: [int..]} +# -> {type: "list"} -> channelids +# <- {type: "channelids", channelids: [int..]} # -> {type: "allocate"} -> allocated # <- {type: "allocated", channelid: int} # -> {type: "claim", channelid: int} @@ -117,7 +117,7 @@ class WebSocketRendezvous(websocket.WebSocketServerProtocol): def handle_list(self): channelids = sorted(self._app.get_allocated()) - self.send("all-channelids", channelids=channelids) + self.send("channelids", channelids=channelids) def handle_allocate(self): if self._channel: diff --git a/tests/test_server.py b/tests/test_server.py index 16a3869..cb2ae85 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -525,7 +525,7 @@ class WebSocketAPI(ServerBase, unittest.TestCase): self.assertEqual(app.get_allocated(), set()) c1.send(u"list") msg = yield c1.next_event() - self.assertEqual(msg["type"], u"all-channelids") + self.assertEqual(msg["type"], u"channelids") self.assertEqual(msg["channelids"], []) c1.send(u"allocate") @@ -539,7 +539,7 @@ class WebSocketAPI(ServerBase, unittest.TestCase): c1.send(u"list") msg = yield c1.next_event() - self.assertEqual(msg["type"], u"all-channelids") + self.assertEqual(msg["type"], u"channelids") self.assertEqual(msg["channelids"], [cid]) c1.send(u"deallocate") @@ -550,7 +550,7 @@ class WebSocketAPI(ServerBase, unittest.TestCase): c1.send(u"list") msg = yield c1.next_event() - self.assertEqual(msg["type"], u"all-channelids") + self.assertEqual(msg["type"], u"channelids") self.assertEqual(msg["channelids"], []) @inlineCallbacks @@ -585,12 +585,12 @@ class WebSocketAPI(ServerBase, unittest.TestCase): c1.send(u"list") msg = yield c1.next_event() - self.assertEqual(msg["type"], u"all-channelids") + self.assertEqual(msg["type"], u"channelids") self.assertEqual(msg["channelids"], [cid]) c2.send(u"list") msg = yield c2.next_event() - self.assertEqual(msg["type"], u"all-channelids") + self.assertEqual(msg["type"], u"channelids") self.assertEqual(msg["channelids"], [cid]) c1.send(u"deallocate") @@ -605,7 +605,7 @@ class WebSocketAPI(ServerBase, unittest.TestCase): c2.send(u"list") msg = yield c2.next_event() - self.assertEqual(msg["type"], u"all-channelids") + self.assertEqual(msg["type"], u"channelids") self.assertEqual(msg["channelids"], []) @inlineCallbacks