示例#1
0
 def test_converted_output(self):
     ir = ImageSource(self.tmp_filename, (100, 100), PNG_FORMAT)
     assert is_png(ir.as_buffer())
     assert is_jpeg(ir.as_buffer(JPEG_FORMAT))
     assert is_jpeg(ir.as_buffer())
     assert is_tiff(ir.as_buffer(TIFF_FORMAT))
     assert is_tiff(ir.as_buffer())
示例#2
0
 def test_converted_output(self):
     ir = ImageSource(self.tmp_filename, (100, 100), PNG_FORMAT)
     assert is_png(ir.as_buffer())
     assert is_jpeg(ir.as_buffer(JPEG_FORMAT))
     assert is_jpeg(ir.as_buffer())
     assert is_tiff(ir.as_buffer(TIFF_FORMAT))
     assert is_tiff(ir.as_buffer())
示例#3
0
 def test_get_tile(self, app, fixture_cache_data):
     resp = app.get("/wmts/myrest/wms_cache/GLOBAL_MERCATOR/01/0/0.jpeg")
     assert resp.content_type == "image/jpeg"
     data = BytesIO(resp.body)
     assert is_jpeg(data)
     # test without leading 0 in level
     resp = app.get("/wmts/myrest/wms_cache/GLOBAL_MERCATOR/1/0/0.jpeg")
     assert resp.content_type == "image/jpeg"
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#4
0
 def test_get_tile(self):
     resp = self.app.get('/wmts/myrest/wms_cache/GLOBAL_MERCATOR/01/0/0.jpeg')
     eq_(resp.content_type, 'image/jpeg')
     data = BytesIO(resp.body)
     assert is_jpeg(data)
     # test without leading 0 in level
     resp = self.app.get('/wmts/myrest/wms_cache/GLOBAL_MERCATOR/1/0/0.jpeg')
     eq_(resp.content_type, 'image/jpeg')
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#5
0
 def test_get_tile(self):
     resp = self.app.get("/wmts/myrest/wms_cache/GLOBAL_MERCATOR/01/0/0.jpeg")
     eq_(resp.content_type, "image/jpeg")
     data = BytesIO(resp.body)
     assert is_jpeg(data)
     # test without leading 0 in level
     resp = self.app.get("/wmts/myrest/wms_cache/GLOBAL_MERCATOR/1/0/0.jpeg")
     eq_(resp.content_type, "image/jpeg")
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#6
0
    def test_get_tile(self, app, fixture_cache_data):
        resp = app.get(str(self.common_tile_req))
        assert resp.content_type == "image/jpeg"
        data = BytesIO(resp.body)
        assert is_jpeg(data)

        # test with integer tilematrix
        url = str(self.common_tile_req).replace("=01", "=1")
        resp = app.get(url)
        assert resp.content_type == "image/jpeg"
        data = BytesIO(resp.body)
        assert is_jpeg(data)
示例#7
0
    def test_get_tile(self):
        resp = self.app.get(str(self.common_tile_req))
        eq_(resp.content_type, 'image/jpeg')
        data = BytesIO(resp.body)
        assert is_jpeg(data)

        # test with integer tilematrix
        url = str(self.common_tile_req).replace('=01', '=1')
        resp = self.app.get(url)
        eq_(resp.content_type, 'image/jpeg')
        data = BytesIO(resp.body)
        assert is_jpeg(data)
示例#8
0
 def test_get_tile_w_rounded_bbox(self, app, fixture_cache_data):
     self.common_map_req.params.bbox = "-20037400,0.0,0.0,20037400"
     resp = app.get(str(self.common_map_req) + "&tiled=true")
     assert "public" in resp.headers["Cache-Control"]
     assert resp.content_type == "image/jpeg"
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#9
0
 def test_get_tile_w_rounded_bbox(self):
     self.common_map_req.params.bbox = '-20037400,0.0,0.0,20037400'
     resp = self.app.get(str(self.common_map_req) + '&tiled=true')
     assert 'public' in resp.headers['Cache-Control']
     eq_(resp.content_type, 'image/jpeg')
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#10
0
 def test_get_tile_w_rounded_bbox(self):
     self.common_map_req.params.bbox = '-20037400,0.0,0.0,20037400'
     resp = self.app.get(str(self.common_map_req) + '&tiled=true')
     assert 'public' in resp.headers['Cache-Control']
     eq_(resp.content_type, 'image/jpeg')
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#11
0
 def test_get_tile_uncached(self):
     resp = self.app.get('/tms/1.0.0/wms_cache/0/0/0.jpeg')
     eq_(resp.content_type, 'image/jpeg')
     data = StringIO(resp.body)
     assert is_jpeg(data)
     img = Image.open(data)
     eq_(img.mode, 'RGB')
     eq_(img.getcolors(), [(256*256, (255, 255, 255))])
示例#12
0
 def test_get_tile_uncached(self):
     resp = self.app.get('/tms/1.0.0/wms_cache/0/0/0.jpeg')
     eq_(resp.content_type, 'image/jpeg')
     data = StringIO(resp.body)
     assert is_jpeg(data)
     img = Image.open(data)
     eq_(img.mode, 'RGB')
     eq_(img.getcolors(), [(256 * 256, (255, 255, 255))])
示例#13
0
 def test_tms(self):
     resp = self.app.get(
         '/tms/1.0.0/wms_cache/0/0/1.jpeg',
         extra_environ={'mapproxy.decorate_img': to_greyscale})
     eq_(resp.content_type, 'image/jpeg')
     eq_(resp.content_length, len(resp.body))
     data = StringIO(resp.body)
     assert is_jpeg(data)
示例#14
0
 def test_wmts(self):
     resp = self.app.get(
         str(self.common_tile_req),
         extra_environ={'mapproxy.decorate_img': to_greyscale})
     eq_(resp.content_type, 'image/jpeg')
     eq_(resp.content_length, len(resp.body))
     data = StringIO(resp.body)
     assert is_jpeg(data)
示例#15
0
 def test_get_tile_cached(self):
     resp = self.app.get('/tms/1.0.0/wms_cache/0/0/1.jpeg')
     eq_(resp.content_type, 'image/jpeg')
     data = BytesIO(resp.body)
     assert is_jpeg(data)
     img = Image.open(data)
     eq_(img.mode, 'RGB')
     # cached image has more that 256 colors, getcolors -> None
     eq_(img.getcolors(), None)
示例#16
0
 def test_get_tile_cached(self, app, fixture_cache_data):
     resp = app.get("/tms/1.0.0/wms_cache/0/0/1.jpeg")
     assert resp.content_type == "image/jpeg"
     data = BytesIO(resp.body)
     assert is_jpeg(data)
     img = Image.open(data)
     assert img.mode == "RGB"
     # cached image has more that 256 colors, getcolors -> None
     assert img.getcolors() == None
示例#17
0
 def test_wmts(self, app):
     resp = app.get(
         str(self.common_tile_req),
         extra_environ={"mapproxy.decorate_img": to_greyscale},
     )
     assert resp.content_type == "image/jpeg"
     assert resp.content_length == len(resp.body)
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#18
0
 def test_get_tile_cached(self):
     resp = self.app.get('/tms/1.0.0/wms_cache/0/0/1.jpeg')
     eq_(resp.content_type, 'image/jpeg')
     data = StringIO(resp.body)
     assert is_jpeg(data)
     img = Image.open(data)
     eq_(img.mode, 'RGB')
     # cached image has more that 256 colors, getcolors -> None
     eq_(img.getcolors(), None)
示例#19
0
 def test_tms(self, app):
     resp = app.get(
         "/tms/1.0.0/wms_cache/0/0/1.jpeg",
         extra_environ={"mapproxy.decorate_img": to_greyscale},
     )
     assert resp.content_type == "image/jpeg"
     assert resp.content_length == len(resp.body)
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#20
0
 def test_tms(self):
     resp = self.app.get(
         '/tms/1.0.0/wms_cache/0/0/1.jpeg',
         extra_environ={'mapproxy.decorate_img': to_greyscale}
     )
     eq_(resp.content_type, 'image/jpeg')
     eq_(resp.content_length, len(resp.body))
     data = StringIO(resp.body)
     assert is_jpeg(data)
示例#21
0
 def test_wmts(self):
     resp = self.app.get(
         str(self.common_tile_req),
         extra_environ={'mapproxy.decorate_img': to_greyscale}
     )
     eq_(resp.content_type, 'image/jpeg')
     eq_(resp.content_length, len(resp.body))
     data = StringIO(resp.body)
     assert is_jpeg(data)
示例#22
0
 def test_get_cached_tile_service_origin(self, app):
     resp = app.get("/tiles/wms_cache/1/0/0.jpeg")
     assert resp.content_type == "image/jpeg"
     assert is_jpeg(resp.body)
示例#23
0
 def test_get_tile(self):
     resp = self.app.get(str(self.common_tile_req))
     eq_(resp.content_type, 'image/jpeg')
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#24
0
 def test_get_cached_tile_request_origin(self, app):
     resp = app.get("/tiles/wms_cache/1/0/1.jpeg?origin=sw")
     assert resp.content_type == "image/jpeg"
     assert is_jpeg(resp.body)
示例#25
0
 def test_get_cached_tile_request_origin(self):
     resp = self.app.get('/tiles/wms_cache/1/0/1.jpeg?origin=sw')
     eq_(resp.content_type, 'image/jpeg')
     assert is_jpeg(resp.body)
示例#26
0
 def test_get_tile(self, app, fixture_cache_data):
     resp = app.get(str(self.common_map_req) + "&tiled=true")
     assert "public" in resp.headers["Cache-Control"]
     assert resp.content_type == "image/jpeg"
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#27
0
 def test_get_tile(self):
     resp = self.app.get(str(self.common_map_req) + '&tiled=true')
     assert 'public' in resp.headers['Cache-Control']
     eq_(resp.content_type, 'image/jpeg')
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#28
0
 def test_get_cached_tile(self):
     resp = self.app.get('/tms/1.0.0/wms_cache/0/0/1.jpeg')
     eq_(resp.content_type, 'image/jpeg')
     eq_(resp.content_length, len(resp.body))
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#29
0
 def test_get_cached_tile(self):
     resp = self.app.get('/tms/1.0.0/wms_cache/0/0/1.jpeg')
     eq_(resp.content_type, 'image/jpeg')
     eq_(resp.content_length, len(resp.body))
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#30
0
 def _check_tile_resp(self, resp):
     assert resp.content_type == "image/jpeg"
     assert resp.content_length == len(resp.body)
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#31
0
 def test_get_cached_tile_tms(self):
     resp = self.app.get('/tms/1.0.0/wms_cache/0/0/1.jpeg')
     eq_(resp.content_type, 'image/jpeg')
     assert is_jpeg(resp.body)
示例#32
0
 def _check_tile_resp(self, resp):
     eq_(resp.content_type, 'image/jpeg')
     eq_(resp.content_length, len(resp.body))
     data = StringIO(resp.body)
     assert is_jpeg(data)
示例#33
0
 def test_get_tile(self):
     resp = self.app.get(str(self.common_tile_req))
     eq_(resp.content_type, 'image/jpeg')
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#34
0
 def test_get_cached_tile_tms(self, app):
     resp = app.get("/tms/1.0.0/wms_cache/0/0/1.jpeg")
     assert resp.content_type == "image/jpeg"
     assert is_jpeg(resp.body)
示例#35
0
 def test_get_cached_tile(self, app, fixture_cache_data):
     resp = app.get("/tms/1.0.0/wms_cache/0/0/1.jpeg")
     assert resp.content_type == "image/jpeg"
     assert resp.content_length == len(resp.body)
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#36
0
 def _check_tile_resp(self, resp):
     eq_(resp.content_type, 'image/jpeg')
     eq_(resp.content_length, len(resp.body))
     data = BytesIO(resp.body)
     assert is_jpeg(data)
示例#37
0
 def test_get_cached_tile_tms(self):
     resp = self.app.get('/tms/1.0.0/wms_cache/0/0/1.jpeg')
     eq_(resp.content_type, 'image/jpeg')
     assert is_jpeg(resp.body)
示例#38
0
 def test_get_cached_tile_request_origin(self):
     resp = self.app.get('/tiles/wms_cache/1/0/1.jpeg?origin=sw')
     eq_(resp.content_type, 'image/jpeg')
     assert is_jpeg(resp.body)
示例#39
0
 def test_get_tile(self):
     resp = self.app.get(str(self.common_map_req) + '&tiled=true')
     assert 'public' in resp.headers['Cache-Control']
     eq_(resp.content_type, 'image/jpeg')
     data = BytesIO(resp.body)
     assert is_jpeg(data)