Skip to content
Snippets Groups Projects
Commit 1f1bf8b8 authored by Erik Reid's avatar Erik Reid
Browse files

added /poller/eumetsat-multicast test

parent 5243d531
No related branches found
No related tags found
No related merge requests found
import json
import jsonschema
from inventory_provider.routes.poller import INTERFACE_LIST_SCHEMA
from inventory_provider.routes import poller
DEFAULT_REQUEST_HEADERS = {
"Content-type": "application/json",
......@@ -15,7 +15,38 @@ def test_get_all_interfaces(client):
assert rv.status_code == 200
assert rv.is_json
response_data = json.loads(rv.data.decode('utf-8'))
jsonschema.validate(response_data, INTERFACE_LIST_SCHEMA)
jsonschema.validate(response_data, poller.INTERFACE_LIST_SCHEMA)
response_routers = {ifc['router'] for ifc in response_data}
assert len(response_routers) > 1, \
'there should data from be lots of routers'
def test_all_router_interface_speeds(client):
rv = client.post(
f'/poller/speeds',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
response = json.loads(rv.data.decode("utf-8"))
jsonschema.validate(response, poller.INTERFACE_SPEED_LIST_SCHEMA)
assert response # at least shouldn't be empty
response_routers = {ifc['router'] for ifc in response}
assert len(response_routers) > 1, \
'there should data from be lots of routers'
def test_eumetsat_multicast(mocker, client):
# routers don't have snmp acl's for us
mocker.patch('inventory_provider.juniper.snmp_community_string') \
.return_value = 'blah'
rv = client.get(
'/poller/eumetsat-multicast',
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, poller.MULTICAST_SUBSCRIPTION_LIST_SCHEMA)
assert response_data, "the subscription list shouldn't be empty"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment