Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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))])
Exemplo n.º 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))])
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)