Skip to content
Snippets Groups Projects
Select Git revision
  • 287122ffacbdf2bf2b55a95c0f7b19dcc2db1a20
  • develop default
  • master protected
  • feature/frontend-tests
  • 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
  • 0.86
  • 0.85
  • 0.84
  • 0.83
  • 0.82
  • 0.81
  • 0.80
24 results

survey.py

Blame
  • test_testing_routes.py 2.46 KiB
    import json
    import jsonschema
    
    DEFAULT_REQUEST_HEADERS = {
        "Content-type": "application/json",
        "Accept": ["application/json"]
    }
    
    ROUTER_LIST_SCHEMA = {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "type": "array",
        "items": {"type": "string"}
    }
    
    
    def test_flushdb(client):
        rv = client.post("/testing/flushdb")
        assert rv.status_code == 200
    
    
    def test_juniper_addresses(client):
        rv = client.post(
            "/testing/juniper-server-addresses",
            headers=DEFAULT_REQUEST_HEADERS)
        assert rv.status_code == 200
        response_data = json.loads(rv.data.decode('utf-8'))
        jsonschema.validate(response_data, ROUTER_LIST_SCHEMA)
        assert len(response_data) > 0  # test data is not empty
    
    
    def test_get_equipment_location_all(client):
        rv = client.get(
            '/testing/opsdb/equipment-location',
            headers=DEFAULT_REQUEST_HEADERS)
        assert rv.status_code == 200
        assert rv.is_json
        # TODO: validate against schema
    
    
    def test_get_interface_info(client):
        rv = client.get(
            '/testing/opsdb/interfaces',
            headers=DEFAULT_REQUEST_HEADERS)
        assert rv.status_code == 200
        assert rv.is_json
        # TODO: validate against schema
    
    
    def test_get_interface_info_for_equipment(client):
        rv = client.get(
            '/testing/opsdb/interfaces/mx1.ams.nl.geant.net',
            headers=DEFAULT_REQUEST_HEADERS)
        assert rv.status_code == 200
        assert rv.is_json
        # TODO: validate against schema
    
    
    def test_get_interface_info_for_equipment_and_interface(
                client):
        rv = client.get(
            '/testing/opsdb/interfaces/mx1.ams.nl.geant.net/ae3.0',
            headers=DEFAULT_REQUEST_HEADERS)
        assert rv.status_code == 200
        assert rv.is_json
        # TODO: validate against schema
    
    
    def test_get_children(client):
        rv = client.get(
            '/testing/opsdb/circuit-hierarchy/children/12363',
            headers=DEFAULT_REQUEST_HEADERS)
        assert rv.status_code == 200
        assert rv.is_json
        # TODO: validate against schema
    
    
    def test_get_parents(client):
        rv = client.get(
            '/testing/opsdb/circuit-hierarchy/parents/47141',
            headers=DEFAULT_REQUEST_HEADERS)
        assert rv.status_code == 200
        assert rv.is_json
        # TODO: validate against schema
    
    
    def test_get_equipment_location(client):
        rv = client.get(
            '/testing/opsdb/equipment-location/mx1.ams.nl.geant.net',
            headers=DEFAULT_REQUEST_HEADERS)
        assert rv.status_code == 200
        assert rv.is_json
        # TODO: validate against schema