Пример #1
0
def all_projects():
    client = xmlrpc_client.ServerProxy('http://pypi.python.org/pypi')
    return client.list_packages()
Пример #2
0
 def get_server_proxy(self):
     return xmlrpc_client.ServerProxy(PYPI_URL)
def test_xmlrpc_bytes(live_server):

    c = xmlrpc_client.ServerProxy(live_server.url + '/all-rpc/')

    result = c.get_bytes()
    assert result == b'abcde'
def test_xmlrpc_null(live_server):

    c = xmlrpc_client.ServerProxy(live_server.url + '/all-rpc/')

    assert c.get_null() is None
def test_xmlrpc_get_signature_invalid_method(live_server):
    c = xmlrpc_client.ServerProxy(live_server.url + '/all-rpc/')

    with pytest.raises(xmlrpc_client.Fault):
        c.system.methodSignature('inexistant_method')
def test_xmlrpc_protocol_specific_methods_2(live_server):

    c = xmlrpc_client.ServerProxy(live_server.url + '/xml-only/')

    # method_y is available only via XML-RPC
    assert c.method_y() == 'XML only'
def test_xmlrpc_basic_add(live_server):
    c = xmlrpc_client.ServerProxy(live_server.url + '/all-rpc/')
    assert c.add(2, 3) == 5
def test_xmlrpc_method_help_invalid_method(live_server):

    c = xmlrpc_client.ServerProxy(live_server.url + '/all-rpc/')

    with pytest.raises(xmlrpc_client.Fault):
        c.system.methodHelp('inexistant_method')
def test_xmlrpc_method_help_2(live_server):

    c = xmlrpc_client.ServerProxy(live_server.url + '/all-rpc/')

    help_msg = c.system.methodHelp('divide')
    assert 'Divide a numerator by a denominator' in help_msg