Skip to content
Snippets Groups Projects
Select Git revision
  • 86b1bdaf37c81b05350ee323d21b3b9cd24e82cb
  • develop default protected
  • feature/clean-callback-progress
  • master protected
  • authorship-fix-from-develop
  • 1048-service-config-backfilling
  • feature/nat-1211-edgeport-lacp-xmit
  • fix/nat-1120-sdp-validation
  • NAT-1154-import-edge-port-update
  • fix/l3-imports
  • feature/10GGBS-NAT-980
  • fix/NAT-1009/fix-redeploy-base-config-if-there-is-a-vprn
  • 4.24
  • 4.23
  • 4.22
  • 4.21
  • 4.20
  • 4.19
  • 4.18
  • 4.17
  • 4.16
  • 4.15
  • 4.14
  • 4.13
  • 4.12
  • 4.11
  • 4.10
  • 4.8
  • 4.5
  • 4.4
  • 4.3
  • 4.2
32 results

build-docs.sh

Blame
  • test_neteng_routes.py 1.68 KiB
    import json
    import jsonschema
    import pytest
    
    from inventory_provider.db.ims_data \
        import NODE_LOCATION_SCHEMA, POP_LOCATION_SCHEMA
    from inventory_provider.routes.neteng import STRING_LIST_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
    
    
    def test_get_pops(client, mocked_redis):
        rv = client.get(
            '/neteng/pops',
            headers={'Accept': ['application/json']})
        assert rv.status_code == 200
        jsonschema.validate(
            json.loads(rv.data.decode('utf-8')),
            STRING_LIST_SCHEMA)
    
    
    @pytest.mark.parametrize('pop_name', [
        'AMSTERDAM', 'VIENNA', 'LONDON', 'LONDON 2'
    ])
    def test_pop_location(client, mocked_redis, pop_name):
        rv = client.post(
            f'/neteng/pop/{pop_name}',
            headers={'Accept': ['application/json']})
        assert rv.status_code == 200
        jsonschema.validate(
            json.loads(rv.data.decode('utf-8')),
            POP_LOCATION_SCHEMA)
        s = json.loads(rv.data.decode('utf-8'))
        print(s)
    
    
    def test_pop_not_found(client, mocked_redis):
        rv = client.post(
            '/neteng/pop/BOGUS.POP.NAME',
            headers={'Accept': ['application/json']})
        assert rv.status_code == 404