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

test update_interfaces_to_services

parent 162e99ba
Branches
Tags
No related merge requests found
......@@ -226,3 +226,24 @@ def test_build_snmp_peering_db(mocked_worker_module):
found_record = True
assert found_record
def test_update_interfaces_to_services(mocker, mocked_worker_module):
test_data = [
{'equipment': 'eqa', 'interface_name': 'ifca', 'x': 99},
{'equipment': 'eqb', 'interface_name': 'ifcb', 'z': {'a': 1}}
]
get_circuits = mocker.patch('inventory_provider.db.opsdb.get_circuits')
get_circuits.return_value = test_data
db = backend_db() # also forces initialization
db.clear()
worker.update_interfaces_to_services()
for service in test_data:
key = 'opsdb:interface_services:{equipment}:{interface_name}'.format(
**service)
cached_service = json.loads(db[key])
assert cached_service == [service]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment