|
|
|
@ -10,9 +10,11 @@ from websocket import create_connection
|
|
|
|
|
host = os.getenv('WEBDIS_HOST', '127.0.0.1')
|
|
|
|
|
port = int(os.getenv('WEBDIS_PORT', 7379))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def connect(format):
|
|
|
|
|
return create_connection(f'ws://{host}:{port}/.{format}')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestWebdis(unittest.TestCase):
|
|
|
|
|
def setUp(self) -> None:
|
|
|
|
|
self.ws = connect(self.format())
|
|
|
|
@ -143,7 +145,8 @@ class TestPubSub(unittest.TestCase):
|
|
|
|
|
self.assertEqual(sub_contents[0], 'message') # first element is the message type, here a push
|
|
|
|
|
channel = sub_contents[1]
|
|
|
|
|
self.assertTrue(channel in channels) # second is the channel
|
|
|
|
|
received_per_channel[channel].append(sub_contents[2]) # third, add to list of messages received for this channel
|
|
|
|
|
received_per_channel[channel].append(
|
|
|
|
|
sub_contents[2]) # third, add to list of messages received for this channel
|
|
|
|
|
|
|
|
|
|
# unsubscribe from all channels
|
|
|
|
|
subs_remaining = channel_count
|
|
|
|
|