mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-23 14:52:26 +00:00
Merge pull request #1042 from tahoe-lafs/3626.streaming-logs-with-bytes
Handle bytes in log messages streamed over websocket Fixes ticket:3626
This commit is contained in:
commit
19a3481e5f
0
newsfragments/3626.minor
Normal file
0
newsfragments/3626.minor
Normal file
@ -92,7 +92,7 @@ class TestStreamingLogs(unittest.TestCase):
|
||||
@inlineCallbacks
|
||||
def test_one_log(self):
|
||||
"""
|
||||
write a single Eliot log and see it streamed via websocket
|
||||
Write a single Eliot log actin and see it streamed via websocket.
|
||||
"""
|
||||
|
||||
proto = yield self.agent.open(
|
||||
@ -106,14 +106,18 @@ class TestStreamingLogs(unittest.TestCase):
|
||||
proto.on("message", got_message)
|
||||
|
||||
@log_call(action_type=u"test:cli:some-exciting-action")
|
||||
def do_a_thing():
|
||||
def do_a_thing(arguments):
|
||||
pass
|
||||
|
||||
do_a_thing()
|
||||
do_a_thing(arguments=[u"hello", b"good-day", 123, {"a": 35}, [None]])
|
||||
|
||||
proto.transport.loseConnection()
|
||||
yield proto.is_closed
|
||||
|
||||
self.assertEqual(len(messages), 2)
|
||||
self.assertEqual(messages[0]["action_type"], "test:cli:some-exciting-action")
|
||||
self.assertEqual(messages[0]["arguments"],
|
||||
["hello", "good-day", 123, {"a": 35}, [None]])
|
||||
self.assertEqual(messages[1]["action_type"], "test:cli:some-exciting-action")
|
||||
self.assertEqual("started", messages[0]["action_status"])
|
||||
self.assertEqual("succeeded", messages[1]["action_status"])
|
||||
|
@ -8,8 +8,6 @@ from __future__ import (
|
||||
division,
|
||||
)
|
||||
|
||||
import json
|
||||
|
||||
from autobahn.twisted.resource import WebSocketResource
|
||||
from autobahn.twisted.websocket import (
|
||||
WebSocketServerFactory,
|
||||
@ -21,6 +19,8 @@ from twisted.web.resource import (
|
||||
Resource,
|
||||
)
|
||||
|
||||
from allmydata.util import jsonbytes as json
|
||||
|
||||
|
||||
class TokenAuthenticatedWebSocketServerProtocol(WebSocketServerProtocol):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user