test_general_lnetd_routes.py 607 B
import json
import jsonschema
from inventory_provider.routes import lnetd
DEFAULT_REQUEST_HEADERS = {
'Accept': ['application/json']
}
def test_get_all_interfaces(client):
rv = client.get(
'/LnetD/interfaces',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
response_data = json.loads(rv.data.decode('utf-8'))
jsonschema.validate(response_data, lnetd.INTERFACE_LIST_SCHEMA)
response_routers = {ifc['hostname'] for ifc in response_data}
assert len(response_routers) > 1, \
'there should data from be lots of routers'