Exemple #1
0
 def test_arcgiscache_path(self):
     template = TileURLTemplate(TESTSERVER_URL + '/%(arcgiscache_path)s.png')
     client = TileClient(template)
     with mock_httpd(TESTSERVER_ADDRESS, [({'path': '/L09/R0000000d/C00000005.png'},
                                           {'body': b'tile',
                                            'headers': {'content-type': 'image/png'}})]):
         resp = client.get_tile((5, 13, 9)).source.read()
         eq_(resp, b'tile')
Exemple #2
0
 def test_xyz(self):
     template = TileURLTemplate(TESTSERVER_URL + '/x=%(x)s&y=%(y)s&z=%(z)s&format=%(format)s')
     client = TileClient(template)
     with mock_httpd(TESTSERVER_ADDRESS, [({'path': '/x=5&y=13&z=9&format=png'},
                                           {'body': b'tile',
                                            'headers': {'content-type': 'image/png'}})]):
         resp = client.get_tile((5, 13, 9)).source.read()
         eq_(resp, b'tile')
Exemple #3
0
 def test_arcgiscache_path(self):
     template = TileURLTemplate(TESTSERVER_URL + '/%(arcgiscache_path)s.png')
     client = TileClient(template)
     with mock_httpd(TESTSERVER_ADDRESS, [({'path': '/L09/R0000000d/C00000005.png'},
                                           {'body': b'tile',
                                            'headers': {'content-type': 'image/png'}})]):
         resp = client.get_tile((5, 13, 9)).source.read()
         assert resp == b'tile'
Exemple #4
0
 def test_xyz(self):
     template = TileURLTemplate(TESTSERVER_URL + '/x=%(x)s&y=%(y)s&z=%(z)s&format=%(format)s')
     client = TileClient(template)
     with mock_httpd(TESTSERVER_ADDRESS, [({'path': '/x=5&y=13&z=9&format=png'},
                                           {'body': b'tile',
                                            'headers': {'content-type': 'image/png'}})]):
         resp = client.get_tile((5, 13, 9)).source.read()
         assert resp == b'tile'
Exemple #5
0
 def test_bbox(self):
     grid = tile_grid(4326)
     template = TileURLTemplate(TESTSERVER_URL + '/service?BBOX=%(bbox)s')
     client = TileClient(template, grid=grid)
     with mock_httpd(TESTSERVER_ADDRESS, [({'path': '/service?BBOX=-180.00000000,0.00000000,-90.00000000,90.00000000'},
                                           {'body': b'tile',
                                            'headers': {'content-type': 'image/png'}})]):
         resp = client.get_tile((0, 1, 2)).source.read()
         eq_(resp, b'tile')
Exemple #6
0
 def test_bbox(self):
     grid = tile_grid(4326)
     template = TileURLTemplate(TESTSERVER_URL + '/service?BBOX=%(bbox)s')
     client = TileClient(template, grid=grid)
     with mock_httpd(TESTSERVER_ADDRESS, [({'path': '/service?BBOX=-180.00000000,0.00000000,-90.00000000,90.00000000'},
                                           {'body': b'tile',
                                            'headers': {'content-type': 'image/png'}})]):
         resp = client.get_tile((0, 1, 2)).source.read()
         assert resp == b'tile'
Exemple #7
0
 def test_tc_path(self):
     template = TileURLTemplate(TESTSERVER_URL + '/%(tc_path)s.png')
     client = TileClient(template)
     with mock_httpd(TESTSERVER_ADDRESS,
                     [({
                         'path': '/09/000/000/005/000/000/013.png'
                     }, {
                         'body': b'tile',
                         'headers': {
                             'content-type': 'image/png'
                         }
                     })]):
         resp = client.get_tile((5, 13, 9)).source.read()
         eq_(resp, b'tile')
Exemple #8
0
 def test_quadkey(self):
     template = TileURLTemplate(TESTSERVER_URL +
                                '/key=%(quadkey)s&format=%(format)s')
     client = TileClient(template)
     with mock_httpd(TESTSERVER_ADDRESS,
                     [({
                         'path': '/key=000002303&format=png'
                     }, {
                         'body': b'tile',
                         'headers': {
                             'content-type': 'image/png'
                         }
                     })]):
         resp = client.get_tile((5, 13, 9)).source.read()
         eq_(resp, b'tile')