import json import jsonschema import pytest from inventory_provider.db.ims_data import NODE_LOCATION_SCHEMA @pytest.mark.parametrize('equipment_name', [ 'MX1.AMS.NL', 'MIL-OLA1', 'LON02-GRV1' ]) def test_location(client, mocked_redis, equipment_name): rv = client.post( f'/neteng/location/{equipment_name}', headers={'Accept': ['application/json']}) assert rv.status_code == 200 jsonschema.validate( json.loads(rv.data.decode('utf-8')), NODE_LOCATION_SCHEMA) def test_location_not_found(client, mocked_redis): rv = client.post( '/neteng/location/BOGUS.EQUIPMENT.NAME', headers={'Accept': ['application/json']}) assert rv.status_code == 404