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())
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)
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)
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)
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)
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)
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)
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)
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))])
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))])
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)
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)
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)
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
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)