diff --git a/test/test_external_inventory_routes.py b/test/test_external_inventory_routes.py index d17dd4f031b73691c83f810483c0e9dc76bd0be2..4adc7d5890795740626e7a696fe51f6c1a89a6fc 100644 --- a/test/test_external_inventory_routes.py +++ b/test/test_external_inventory_routes.py @@ -101,4 +101,34 @@ def test_get_interface_info_for_equipment_and_interface(mocker, client): def test_get_children(mocker, client): - pass # todo - carry on from here + mocked_redis = mocker.patch( + "inventory_provider.routes.opsdb.db.get_redis") + mocked_hget = mocked_redis.return_value.hget + + rv = client.get( + '/opsdb/circuit-hierarchy/children/22987', + headers=DEFAULT_REQUEST_HEADERS) + assert rv.status_code == 200 + assert rv.is_json + + mocked_hget.assert_called_with( + external_inventory.service_parent_to_children_key, + "22987" + ) + + +def test_get_parents(mocker, client): + mocked_redis = mocker.patch( + "inventory_provider.routes.opsdb.db.get_redis") + mocked_hget = mocked_redis.return_value.hget + + rv = client.get( + '/opsdb/circuit-hierarchy/children/22987', + headers=DEFAULT_REQUEST_HEADERS) + assert rv.status_code == 200 + assert rv.is_json + + mocked_hget.assert_called_with( + external_inventory.service_parent_to_children_key, + "22987" + )