Newer
Older
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"}
}
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
def test_get_equipment_location(client_with_mocked_data):
rv = client_with_mocked_data.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_with_mocked_data):
rv = client_with_mocked_data.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_with_mocked_data):
rv = client_with_mocked_data.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_with_mocked_data):
rv = client_with_mocked_data.get(
'/testing/opsdb/interfaces/mx1.ams.nl.geant.net/ae0.0',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
# TODO: validate against schema
def test_get_children(client_with_mocked_data):
rv = client_with_mocked_data.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_with_mocked_data):
rv = client_with_mocked_data.get(
'/testing/opsdb/circuit-hierarchy/parents/11725',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
# TODO: validate against schema