예제 #1
0
def wfs_gf_mock(url, request):
    pluginTestDir = os.path.dirname(os.path.realpath(__file__))
    filepath = os.path.join(pluginTestDir, 'data', 'wfs_getfeature.xml')
    with open(filepath, 'rb') as tile_image:
        content = tile_image.read()
        headers = {
            'content-length': len(content),
            'content-type': 'application/xml'
        }
        return httmockresponse(200, content, headers, request=request)
예제 #2
0
def wms_gm_mock(url, request):
    pluginTestDir = os.path.dirname(os.path.realpath(__file__))
    filepath = os.path.join(pluginTestDir, 'data', 'wms_getmap.png')
    with open(filepath, 'rb') as tile_image:
        content = tile_image.read()
        headers = {
            'content-length': len(content),
            'content-type': 'image/png'
        }
        return httmockresponse(200, content, headers, request=request)
예제 #3
0
def geocoder_mock(url, request):
    pluginTestDir = os.path.dirname(os.path.realpath(__file__))
    filepath = os.path.join(pluginTestDir, 'data', 'geocoder_response.json')
    with open(filepath) as mock_response:
        content = json.loads(mock_response.read())
        headers = {
            'content-length': len(content),
            'content-type': 'application/json'
        }
        return httmockresponse(200, content, headers, request=request)
예제 #4
0
def wms_gc_mock(url, request):
    pluginTestDir = os.path.dirname(os.path.realpath(__file__))
    filepath = os.path.join(pluginTestDir, 'data', 'wms_capabilities.xml.gz')
    with gzip.open(filepath, 'r') as get_capabilities_file:
        content = get_capabilities_file.read()
        headers = {
            'content-length': len(content),
            'content-type': 'application/xml'
        }
        return httmockresponse(200, content, headers, request=request)
예제 #5
0
def geocoder_mock(url, request):
    pluginTestDir = os.path.dirname(os.path.realpath(__file__))
    filepath = os.path.join(pluginTestDir, 'data', 'geocoder_response.json')
    with open(filepath) as mock_response:
        content = json.loads(mock_response.read())
        headers = {
            'content-length': len(content),
            'content-type': 'application/json'
        }
        return httmockresponse(200, content, headers, request=request)