def test_json_rpc(self, mock_socket, mock_uuid):
        mock_uuid.return_value = '2'

        connection = ControlClient(host='127.0.0.1', port='10001')
        connection.json_rpc('foo')

        mock_socket.assert_has_calls(
            [call(),
             call().connect('tcp://127.0.0.1:10001'),
             call().send_json({'method': 'foo', 'params': (), 'jsonrpc': '2.0', 'id': '2'}),
             call().recv_json()])
Esempio n. 2
0
    def test_json_rpc(self, mock_socket, mock_uuid):
        mock_uuid.return_value = "2"

        connection = ControlClient(host="127.0.0.1", port="10001")
        connection.json_rpc("foo")

        mock_socket.assert_has_calls([
            call(),
            call().connect("tcp://127.0.0.1:10001"),
            call().send_json({
                "method": "foo",
                "params": (),
                "jsonrpc": "2.0",
                "id": "2"
            }),
            call().recv_json(),
        ])
    def testjson_rpc(self, mock_socket, mock_uuid):
        mock_uuid.return_value = '2'

        connection = ControlClient(host='127.0.0.1', port='10001')
        connection.json_rpc('foo')

        mock_socket.assert_has_calls([
            call(),
            call().connect('tcp://127.0.0.1:10001'),
            call().send_json({
                'method': 'foo',
                'params': (),
                'jsonrpc': '2.0',
                'id': '2'
            }),
            call().recv_json()
        ])