Пример #1
0
    def test_subscriber_connection(self):
        proto = SubscriberProtocol("test", lambda _: None)
        proto.makeConnection(MagicMock())

        proto.connectionMade()

        proto.transport.write.assert_called_with(make_subscribe_request("test"))
Пример #2
0
    def test_subscriber_received(self):
        callmock = MagicMock()
        proto = SubscriberProtocol("test", callmock)
        proto.makeConnection(MagicMock())

        proto.dataReceived(json.dumps({"testdata": 5}))

        callmock.assert_called_with(testdata=5)
Пример #3
0
    def test_subscriber_received(self):
        callmock = MagicMock()
        proto = SubscriberProtocol('test', callmock)
        proto.makeConnection(MagicMock())

        proto.dataReceived(json.dumps({'testdata': 5}))

        callmock.assert_called_with(testdata=5)
Пример #4
0
    def test_subscriber_connection(self):
        proto = SubscriberProtocol('test', lambda _: None)
        proto.makeConnection(MagicMock())

        proto.connectionMade()

        proto.transport.write.assert_called_with(
            make_subscribe_request('test'))