-
Robert Latta authoredRobert Latta authored
test_testing_routes.py 2.46 KiB
import json
import jsonschema
DEFAULT_REQUEST_HEADERS = {
"Content-type": "application/json",
"Accept": ["application/json"]
}
ROUTER_LIST_SCHEMA = {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"items": {"type": "string"}
}
def test_flushdb(client):
rv = client.post("/testing/flushdb")
assert rv.status_code == 200
def test_juniper_addresses(client):
rv = client.post(
"/testing/juniper-server-addresses",
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
response_data = json.loads(rv.data.decode('utf-8'))
jsonschema.validate(response_data, ROUTER_LIST_SCHEMA)
assert len(response_data) > 0 # test data is not empty
def test_get_equipment_location_all(client):
rv = client.get(
'/testing/opsdb/equipment-location',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
# TODO: validate against schema
def test_get_interface_info(client):
rv = client.get(
'/testing/opsdb/interfaces',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
# TODO: validate against schema
def test_get_interface_info_for_equipment(client):
rv = client.get(
'/testing/opsdb/interfaces/mx1.ams.nl.geant.net',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
# TODO: validate against schema
def test_get_interface_info_for_equipment_and_interface(
client):
rv = client.get(
'/testing/opsdb/interfaces/mx1.ams.nl.geant.net/ae3.0',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
# TODO: validate against schema
def test_get_children(client):
rv = client.get(
'/testing/opsdb/circuit-hierarchy/children/12363',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
# TODO: validate against schema
def test_get_parents(client):
rv = client.get(
'/testing/opsdb/circuit-hierarchy/parents/47141',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
# TODO: validate against schema
def test_get_equipment_location(client):
rv = client.get(
'/testing/opsdb/equipment-location/mx1.ams.nl.geant.net',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
# TODO: validate against schema