Skip to content
Snippets Groups Projects
Select Git revision
  • f5c4f1d4adf7b2b1db1ef85cd5b96d8889694dfa
  • develop default
  • master protected
  • feature/frontend-tests
  • 0.106
  • 0.105
  • 0.104
  • 0.103
  • 0.102
  • 0.101
  • 0.100
  • 0.99
  • 0.98
  • 0.97
  • 0.96
  • 0.95
  • 0.94
  • 0.93
  • 0.92
  • 0.91
  • 0.90
  • 0.89
  • 0.88
  • 0.87
24 results

App.tsx

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