def test_sendMessage():
    proto = MessageProtocol()

    proto.sendString = MagicMock()
    msg_dict = {
        'type': 'message',
        'message': 'hello'
    }
    proto.sendMessage(msg_dict)
    assert 1 == proto.sendString.call_count
    assert json.dumps(msg_dict) == proto.sendString.call_args[0][0]
dataset/ETHPy150Open hpk42/p4p/tests/test_protocol.py/test_sendMessage/original