Skip to content
Snippets Groups Projects
Select Git revision
  • a378a9ef6dd1a47ab68163e62f8c2524af3dd477
  • develop default
  • master protected
  • inventoryProvider-functional
  • inventoryProvider-morework2
  • circuit-service-details-fix
  • lookup-SPECTRUM-SCHF-ports
  • inventoryProvider-1267-cleanup
  • inventoryProvider-moreWork
  • feature/DBOARD3-958
  • release/0.110
  • fix-uuid-validation-error
  • docker-poc
  • 0.154
  • 0.153
  • 0.152
  • 0.151
  • 0.150
  • 0.149
  • 0.148
  • 0.147
  • 0.146
  • 0.145
  • 0.144
  • 0.143
  • 0.142
  • 0.141
  • 0.140
  • 0.139
  • 0.138
  • 0.137
  • 0.136
  • 0.135
33 results

install-sdist-to-test.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