Skip to content
Snippets Groups Projects
Commit 5fcba8f7 authored by Robert Latta's avatar Robert Latta
Browse files

added ims classifier tests

parent e089f045
No related branches found
No related tags found
No related merge requests found
...@@ -14,8 +14,8 @@ DEFAULT_REQUEST_HEADERS = { ...@@ -14,8 +14,8 @@ DEFAULT_REQUEST_HEADERS = {
} }
def test_juniper_link_info(client): def test_juniper_link_info(ims_client):
rv = client.get( rv = ims_client.get(
'/classifier/juniper-link-info/mx1.ams.nl.geant.net/ae16.100', '/classifier/juniper-link-info/mx1.ams.nl.geant.net/ae16.100',
headers=DEFAULT_REQUEST_HEADERS) headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200 assert rv.status_code == 200
...@@ -24,8 +24,8 @@ def test_juniper_link_info(client): ...@@ -24,8 +24,8 @@ def test_juniper_link_info(client):
jsonschema.validate(response_data, JUNIPER_LINK_RESPONSE_SCHEMA) jsonschema.validate(response_data, JUNIPER_LINK_RESPONSE_SCHEMA)
def test_juniper_link_info_not_found(client): def test_juniper_link_info_not_found(ims_client):
rv = client.get( rv = ims_client.get(
'/classifier/juniper-link-info/' '/classifier/juniper-link-info/'
'mx1.ams.nl.geant.net/unknown-interface-name', 'mx1.ams.nl.geant.net/unknown-interface-name',
headers=DEFAULT_REQUEST_HEADERS) headers=DEFAULT_REQUEST_HEADERS)
...@@ -51,8 +51,8 @@ def test_juniper_link_info_not_found(client): ...@@ -51,8 +51,8 @@ def test_juniper_link_info_not_found(client):
} }
def test_juniper_link_unknown_router(client): def test_juniper_link_unknown_router(ims_client):
rv = client.get( rv = ims_client.get(
'/classifier/juniper-link-info/' '/classifier/juniper-link-info/'
'unknown-router/unknown-interface-name', 'unknown-router/unknown-interface-name',
headers=DEFAULT_REQUEST_HEADERS) headers=DEFAULT_REQUEST_HEADERS)
...@@ -90,9 +90,9 @@ IX_PUBLIC_PEER_INFO_KEYS = { ...@@ -90,9 +90,9 @@ IX_PUBLIC_PEER_INFO_KEYS = {
('62.40.125.142', {'interfaces', 'locations', 'snmp'}) ('62.40.125.142', {'interfaces', 'locations', 'snmp'})
]) ])
def test_peer_info( def test_peer_info(
client, peer_address, expected_response_keys): ims_client, peer_address, expected_response_keys):
rv = client.get( rv = ims_client.get(
f'/classifier/peer-info/{peer_address}', f'/classifier/peer-info/{peer_address}',
headers=DEFAULT_REQUEST_HEADERS) headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200 assert rv.status_code == 200
...@@ -103,15 +103,15 @@ def test_peer_info( ...@@ -103,15 +103,15 @@ def test_peer_info(
assert set(response_data.keys()) == expected_response_keys assert set(response_data.keys()) == expected_response_keys
def test_peer_invalid_address(client): def test_peer_invalid_address(ims_client):
rv = client.get( rv = ims_client.get(
'/classifier/peer-info/1.2.3.4.5', '/classifier/peer-info/1.2.3.4.5',
headers=DEFAULT_REQUEST_HEADERS) headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 422 assert rv.status_code == 422
def test_peer_not_found(client): def test_peer_not_found(ims_client):
rv = client.get( rv = ims_client.get(
'/classifier/peer-info/1.2.3.4', '/classifier/peer-info/1.2.3.4',
headers=DEFAULT_REQUEST_HEADERS) headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200 assert rv.status_code == 200
...@@ -124,51 +124,51 @@ def test_peer_not_found(client): ...@@ -124,51 +124,51 @@ def test_peer_not_found(client):
('bogus-hostname.with&special.char', ('bogus-hostname.with&special.char',
'234-2345234.7878i234crazynamewithslash/1-2.3') '234-2345234.7878i234crazynamewithslash/1-2.3')
]) ])
def test_coriant_info(client, equipment, entity_name): def test_coriant_info(ims_client, equipment, entity_name):
rv = client.get( rv = ims_client.get(
f'/classifier/coriant-info/{equipment}/{entity_name}', f'/classifier/coriant-info/{equipment}/{entity_name}',
headers=DEFAULT_REQUEST_HEADERS) headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200 assert rv.status_code == 200
assert rv.is_json assert rv.is_json
response_data = json.loads(rv.data.decode('utf-8')) response_data = json.loads(rv.data.decode('utf-8'))
jsonschema.validate(response_data, CORIANT_INFO_RESPONSE_SCHEMA_NEW) jsonschema.validate(response_data, CORIANT_INFO_RESPONSE_SCHEMA)
def test_coriant_info_not_found(client): def test_coriant_info_not_found(ims_client):
""" """
just check the correct method is called, but mock out all sql access just check the correct method is called, but mock out all sql access
""" """
rv = client.get( rv = ims_client.get(
'/classifier/coriant-info/aaa/unparseableentitystring', '/classifier/coriant-info/aaa/unparseableentitystring',
headers=DEFAULT_REQUEST_HEADERS) headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 404 assert rv.status_code == 404
def test_infinera_unparseable_fiberlink(client): def test_infinera_unparseable_fiberlink(ims_client):
rv = client.get( rv = ims_client.get(
'/classifier/infinera-fiberlink-info/unparseableentitystring/aaa', '/classifier/infinera-fiberlink-info/unparseableentitystring/aaa',
headers=DEFAULT_REQUEST_HEADERS) headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 422 assert rv.status_code == 422
rv = client.get( rv = ims_client.get(
'/classifier/infinera-fiberlink-info/XXX-OLA1-XXX02-DTNX10-1/aaa', '/classifier/infinera-fiberlink-info/XXX-OLA1-XXX02-DTNX10-1/aaa',
headers=DEFAULT_REQUEST_HEADERS) headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 422 assert rv.status_code == 422
def test_infinera_fiberlink_not_found(client): def test_infinera_fiberlink_not_found(ims_client):
rv = client.get( rv = ims_client.get(
'/classifier/infinera-fiberlink-info/' '/classifier/infinera-fiberlink-info/'
'XXX-OLA1-XXX02-DTNX10-1/1-A-2-L1_3-A-2-L1', 'XXX-OLA1-XXX02-DTNX10-1/1-A-2-L1_3-A-2-L1',
headers=DEFAULT_REQUEST_HEADERS) headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 404 assert rv.status_code == 404
def test_infinera_fiberlink(client): def test_infinera_fiberlink(ims_client):
rv = client.get( rv = ims_client.get(
'/classifier/infinera-fiberlink-info/' '/classifier/infinera-fiberlink-info/'
'OOS-OLA1-GHE-OLA1/1-A-3-L1_1-A-2-L1', 'OOS-OLA1-GHE-OLA1/1-A-3-L1_1-A-2-L1',
headers=DEFAULT_REQUEST_HEADERS) headers=DEFAULT_REQUEST_HEADERS)
...@@ -178,8 +178,8 @@ def test_infinera_fiberlink(client): ...@@ -178,8 +178,8 @@ def test_infinera_fiberlink(client):
jsonschema.validate(response_data, INFINERA_FIBERLINK_INFO_RESPONSE_SCHEMA) jsonschema.validate(response_data, INFINERA_FIBERLINK_INFO_RESPONSE_SCHEMA)
def test_infinera_lambda(client): def test_infinera_lambda(ims_client):
rv = client.get( rv = ims_client.get(
'/classifier/infinera-lambda-info/' '/classifier/infinera-lambda-info/'
'LON2-DTNX10-1/1-A-2-1-4/gen-lon3_LHC_CERN-JANET_09013', 'LON2-DTNX10-1/1-A-2-1-4/gen-lon3_LHC_CERN-JANET_09013',
headers=DEFAULT_REQUEST_HEADERS) headers=DEFAULT_REQUEST_HEADERS)
......
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