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

added more data for parameterized tests

parent a5464b7d
No related branches found
No related tags found
No related merge requests found
......@@ -274,14 +274,18 @@ def test_peer_not_found(client_with_mocked_data):
assert rv.status_code == 404
def test_coriant_info(client, mocker):
@pytest.mark.parametrize('equipment,entity_name,card_id,port_number', [
('grv3.ams.nl.geant.net', '1-1.3.1-100GbE-ODU4-TTP1', '1-1', '3'),
('bogus-hostname.with&special.char',
'234-2345234.7878i234crazynamewithslash/1-2.3', '234-2345234', '7878')
])
def test_coriant_info(
client, mocker, equipment, entity_name, card_id, port_number):
"""
just check the correct method is called, but mock out all sql access
just check that entity_name is correctly parsed and the correct
method is called, but mock out all sql access
"""
CONNECTION = 'bogus connection'
EQUIPMENT = 'bogus equipment name'
CARD_ID = '123-456'
PORT_NUMBER = '789'
@contextlib.contextmanager
def mocked_connection(ignored):
......@@ -294,10 +298,9 @@ def test_coriant_info(client, mocker):
lambda a, b, c, d: {'C': a, 'E': b, 'CID': c, 'P': d})
rv = client.get(
'/classifier/coriant-info/{eq}/{cid}.{pn}abc.234 af/23'.format(
eq=EQUIPMENT,
cid=CARD_ID,
pn=PORT_NUMBER),
'/classifier/coriant-info/{equipment}/{entity}'.format(
equipment=equipment,
entity=entity_name),
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
......@@ -305,14 +308,14 @@ def test_coriant_info(client, mocker):
response_data = json.loads(rv.data.decode('utf-8'))
expected_response = {
'equipment name': EQUIPMENT,
'card id': CARD_ID,
'port number': PORT_NUMBER,
'equipment name': equipment,
'card id': card_id,
'port number': port_number,
'path': {
'C': CONNECTION,
'E': EQUIPMENT,
'CID': CARD_ID,
'P': PORT_NUMBER
'E': equipment,
'CID': card_id,
'P': port_number
}
}
......
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