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

added coriant 404 test

parent 18fc49f5
No related branches found
No related tags found
No related merge requests found
import contextlib
import json
import jsonschema
import pytest
......@@ -272,7 +273,6 @@ def test_peer_not_found(client_with_mocked_data):
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 404
import contextlib
def test_coriant_info(client, mocker):
"""
......@@ -303,3 +303,25 @@ def test_coriant_info(client, mocker):
assert rv.is_json
response_data = json.loads(rv.data.decode('utf-8'))
assert response_data == expected_response
def test_coriant_info_not_found(client, mocker):
"""
just check the correct method is called, but mock out all sql access
"""
@contextlib.contextmanager
def mocked_connection(ignored):
yield None
mocker.patch(
'inventory_provider.db.db.connection', mocked_connection)
mocker.patch(
'inventory_provider.db.opsdb.get_coriant_path',
lambda a, b, c, d: None)
rv = client.get(
'/classifier/coriant-info/aaa/bbb/ccc',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 404
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