示例#1
0
def test_query_with_limit(stub_get):
    api = BaseAPI(2)
    stub_get('http://localhost:8080/v2/nodes?limit=""', body='[]')
    response = api._query('nodes', limit="")
    assert response == []
示例#2
0
def test_query_endpoint(stub_get):
    api = BaseAPI(2)
    stub_get('http://localhost:8080/v2/nodes', body='[]')
    response = api._query('nodes')
    assert response == []
示例#3
0
def test_query_with_order_by(stub_get):
    api = BaseAPI(2)
    stub_get('http://localhost:8080/v2/nodes?order-by=""', body='[]')
    response = api._query('nodes', order_by="")
    assert response == []
示例#4
0
def test_query_empty_body(stub_get):
    api = BaseAPI(2)
    stub_get('http://localhost:8080/v2/nodes', body='null')
    with pytest.raises(EmptyResponseError):
        api._query('nodes')
示例#5
0
def test_query_connection():
    api = BaseAPI(2)
    with pytest.raises(requests.exceptions.ConnectionError):
        api._query('nodes')
示例#6
0
def test_query_with_include_total(stub_get):
    api = BaseAPI(2)
    stub_get('http://localhost:8080/v2/nodes?include-total=""', body='[]')
    response = api._query('nodes', include_total="")
    assert response == []
示例#7
0
def test_query_with_count_filter(stub_get):
    api = BaseAPI(2)
    stub_get('http://localhost:8080/v2/nodes?count-filter=""', body='[]')
    response = api._query('nodes', count_filter="")
    assert response == []
示例#8
0
def test_query_with_order_by(stub_get):
    api = BaseAPI(2)
    stub_get('http://localhost:8080/v2/nodes?order-by=""', body='[]')
    response = api._query('nodes', order_by="")
    assert response == []
示例#9
0
def test_query_with_limit(stub_get):
    api = BaseAPI(2)
    stub_get('http://localhost:8080/v2/nodes?limit=""', body='[]')
    response = api._query('nodes', limit="")
    assert response == []
示例#10
0
def test_query_endpoint(stub_get):
    api = BaseAPI(2)
    stub_get('http://localhost:8080/v2/nodes', body='[]')
    response = api._query('nodes')
    assert response == []
示例#11
0
def test_query_connection():
    api = BaseAPI(2)
    with pytest.raises(requests.exceptions.ConnectionError):
        api._query('nodes')
示例#12
0
def test_query_empty_body(stub_get):
    api = BaseAPI(2)
    stub_get('http://localhost:8080/v2/nodes', body='null')
    with pytest.raises(EmptyResponseError):
        api._query('nodes')
示例#13
0
def test_query_with_count_filter(stub_get):
    api = BaseAPI(2)
    stub_get('http://localhost:8080/v2/nodes?count-filter=""', body='[]')
    response = api._query('nodes', count_filter="")
    assert response == []
示例#14
0
def test_query_with_include_total(stub_get):
    api = BaseAPI(2)
    stub_get('http://localhost:8080/v2/nodes?include-total=""', body='[]')
    response = api._query('nodes', include_total="")
    assert response == []