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