|
|
@ -283,9 +283,11 @@ class TestWsockHandler(unittest.TestCase):
|
|
|
|
request = HTTPServerRequest(uri='/')
|
|
|
|
request = HTTPServerRequest(uri='/')
|
|
|
|
obj = Mock(spec=WsockHandler, request=request)
|
|
|
|
obj = Mock(spec=WsockHandler, request=request)
|
|
|
|
obj.src_addr = ("127.0.0.1", 8888)
|
|
|
|
obj.src_addr = ("127.0.0.1", 8888)
|
|
|
|
|
|
|
|
|
|
|
|
class FakeWeakRef:
|
|
|
|
class FakeWeakRef:
|
|
|
|
def __init__(self):
|
|
|
|
def __init__(self):
|
|
|
|
self.count = 0
|
|
|
|
self.count = 0
|
|
|
|
|
|
|
|
|
|
|
|
def __call__(self):
|
|
|
|
def __call__(self):
|
|
|
|
self.count += 1
|
|
|
|
self.count += 1
|
|
|
|
return None
|
|
|
|
return None
|
|
|
@ -294,3 +296,4 @@ class TestWsockHandler(unittest.TestCase):
|
|
|
|
obj.worker_ref = ref
|
|
|
|
obj.worker_ref = ref
|
|
|
|
WsockHandler.on_message(obj, b'{"data": "somestuff"}')
|
|
|
|
WsockHandler.on_message(obj, b'{"data": "somestuff"}')
|
|
|
|
self.assertGreaterEqual(ref.count, 1)
|
|
|
|
self.assertGreaterEqual(ref.count, 1)
|
|
|
|
|
|
|
|
obj.close.assert_called_with(reason='No worker found')
|
|
|
|