Esempio n. 1
0
 def tile_request(self, tile, auth):
     env = make_wsgi_env('',
                         extra_environ={
                             'mapproxy.authorize': auth,
                             'PATH_INFO': '/tiles/' + tile
                         })
     req = Request(env)
     return tile_request(req)
Esempio n. 2
0
 def test_tms_request(self):
     env = {"PATH_INFO": "/tms/1.0.0/osm/5/2/3.png", "QUERY_STRING": ""}
     req = Request(env)
     tms = tile_request(req)
     assert isinstance(tms, TMSRequest)
     assert tms.tile == (2, 3, 5)
     assert tms.format == "png"
     assert tms.layer == "osm"
     assert tms.dimensions == {}
Esempio n. 3
0
 def test_tile_request_w_epsg(self):
     env = {"PATH_INFO": "/tiles/1.0.0/osm/EPSG4326/5/2/3.png", "QUERY_STRING": ""}
     req = Request(env)
     tile_req = tile_request(req)
     assert isinstance(tile_req, TileRequest)
     eq_(tile_req.tile, (2, 3, 5))
     eq_(tile_req.format, "png")
     eq_(tile_req.layer, "osm")
     eq_(tile_req.dimensions, {"_layer_spec": "EPSG4326"})
Esempio n. 4
0
 def test_tms_request(self):
     env = {"PATH_INFO": "/tms/1.0.0/osm/5/2/3.png", "QUERY_STRING": ""}
     req = Request(env)
     tms = tile_request(req)
     assert isinstance(tms, TMSRequest)
     eq_(tms.tile, (2, 3, 5))
     eq_(tms.format, "png")
     eq_(tms.layer, "osm")
     eq_(tms.dimensions, {})
Esempio n. 5
0
 def test_tile_request(self):
     env = {"PATH_INFO": "/tiles/1.0.0/osm/5/2/3.png", "QUERY_STRING": ""}
     req = Request(env)
     tile_req = tile_request(req)
     assert isinstance(tile_req, TileRequest)
     assert tile_req.tile == (2, 3, 5)
     assert tile_req.origin == None
     assert tile_req.format == "png"
     assert tile_req.layer == "osm"
     assert tile_req.dimensions == {}
Esempio n. 6
0
 def test_tile_request_flipped_y(self):
     env = {"PATH_INFO": "/tiles/1.0.0/osm/5/2/3.png", "QUERY_STRING": "origin=nw"}
     req = Request(env)
     tile_req = tile_request(req)
     assert isinstance(tile_req, TileRequest)
     eq_(tile_req.tile, (2, 3, 5))  # not jet flipped
     eq_(tile_req.origin, "nw")
     eq_(tile_req.format, "png")
     eq_(tile_req.layer, "osm")
     eq_(tile_req.dimensions, {})
Esempio n. 7
0
 def test_tile_request_w_epsg(self):
     env = {
         'PATH_INFO': '/tiles/1.0.0/osm/EPSG4326/5/2/3.png',
         'QUERY_STRING': '',
     }
     req = Request(env)
     tile_req = tile_request(req)
     assert isinstance(tile_req, TileRequest)
     eq_(tile_req.tile, (2, 3, 5))
     eq_(tile_req.format, 'png')
     eq_(tile_req.layer, 'osm')
     eq_(tile_req.dimensions, {'_layer_spec': 'EPSG4326'})
Esempio n. 8
0
 def test_tms_request(self):
     env = {
         'PATH_INFO': '/tms/1.0.0/osm/5/2/3.png',
         'QUERY_STRING': '',
     }
     req = Request(env)
     tms = tile_request(req)
     assert isinstance(tms, TMSRequest)
     eq_(tms.tile, (2, 3, 5))
     eq_(tms.format, 'png')
     eq_(tms.layer, 'osm')
     eq_(tms.dimensions, {})
Esempio n. 9
0
 def test_tile_request_w_epsg(self):
     env = {
         'PATH_INFO': '/tiles/1.0.0/osm/EPSG4326/5/2/3.png',
         'QUERY_STRING': '',
     }
     req = Request(env)
     tile_req = tile_request(req)
     assert isinstance(tile_req, TileRequest)
     eq_(tile_req.tile, (2, 3, 5))
     eq_(tile_req.format, 'png')
     eq_(tile_req.layer, 'osm')
     eq_(tile_req.dimensions, {'_layer_spec': 'EPSG4326'})
Esempio n. 10
0
 def test_tms_request(self):
     env = {
         'PATH_INFO': '/tms/1.0.0/osm/5/2/3.png',
         'QUERY_STRING': '',
     }
     req = Request(env)
     tms = tile_request(req)
     assert isinstance(tms, TMSRequest)
     eq_(tms.tile, (2, 3, 5))
     eq_(tms.format, 'png')
     eq_(tms.layer, 'osm')
     eq_(tms.dimensions, {})
Esempio n. 11
0
 def test_tile_request_w_epsg(self):
     env = {
         "PATH_INFO": "/tiles/1.0.0/osm/EPSG4326/5/2/3.png",
         "QUERY_STRING": ""
     }
     req = Request(env)
     tile_req = tile_request(req)
     assert isinstance(tile_req, TileRequest)
     assert tile_req.tile == (2, 3, 5)
     assert tile_req.format == "png"
     assert tile_req.layer == "osm"
     assert tile_req.dimensions == {"_layer_spec": "EPSG4326"}
Esempio n. 12
0
 def test_tile_request_flipped_y(self):
     env = {
         'PATH_INFO': '/tiles/1.0.0/osm/5/2/3.png',
         'QUERY_STRING': 'origin=nw',
     }
     req = Request(env)
     tile_req = tile_request(req)
     assert isinstance(tile_req, TileRequest)
     eq_(tile_req.tile, (2, 3, 5))  # not jet flipped
     eq_(tile_req.origin, 'nw')
     eq_(tile_req.format, 'png')
     eq_(tile_req.layer, 'osm')
     eq_(tile_req.dimensions, {})
Esempio n. 13
0
 def test_tile_request_flipped_y(self):
     env = {
         'PATH_INFO': '/tiles/1.0.0/osm/5/2/3.png',
         'QUERY_STRING': 'origin=nw',
     }
     req = Request(env)
     tile_req = tile_request(req)
     assert isinstance(tile_req, TileRequest)
     eq_(tile_req.tile, (2, 3, 5)) # not jet flipped
     eq_(tile_req.origin, 'nw')
     eq_(tile_req.format, 'png')
     eq_(tile_req.layer, 'osm')
     eq_(tile_req.dimensions, {})
Esempio n. 14
0
 def test_tile_request(self):
     env = {
         'PATH_INFO': '/tiles/1.0.0/osm/5/2/3.png',
         'QUERY_STRING': '',
     }
     req = Request(env)
     tile_req = tile_request(req)
     assert isinstance(tile_req, TileRequest)
     eq_(tile_req.tile, (2, 3, 5))
     eq_(tile_req.origin, None)
     eq_(tile_req.format, 'png')
     eq_(tile_req.layer, 'osm')
     eq_(tile_req.dimensions, tuple())
Esempio n. 15
0
 def test_tile_request(self):
     env = {
         'PATH_INFO': '/tiles/1.0.0/osm/5/2/3.png',
         'QUERY_STRING': '',
     }
     req = Request(env)
     tile_req = tile_request(req)
     assert isinstance(tile_req, TileRequest)
     eq_(tile_req.tile, (2, 3, 5))
     eq_(tile_req.origin, None)
     eq_(tile_req.format, 'png')
     eq_(tile_req.layer, 'osm')
     eq_(tile_req.dimensions, tuple())
Esempio n. 16
0
 def tile_request(self, tile, auth):
     env = make_wsgi_env('', extra_environ={'mapproxy.authorize': auth,
                                            'PATH_INFO': '/tiles/'+tile})
     req = Request(env)
     return tile_request(req)