コード例 #1
0
    def test_no_fetch_missing_tiles(self):
        self.args += ['--grid', 'GLOBAL_MERCATOR', '--dest', self.dest,
            '--levels', '0', '--source', 'tms_cache']
        with capture_stderr():
            export_command(self.args)

        eq_(os.listdir(self.dest), ['tile_locks'])
コード例 #2
0
 def test_config_not_found(self):
     self.args = ['command_dummy', '-f', 'foo.bar']
     with capture_stderr() as err:
         try:
             export_command(self.args)
         except SystemExit, ex:
             assert ex.code != 0
         else:
コード例 #3
0
 def test_config_not_found(self):
     self.args = ['command_dummy', '-f', 'foo.bar']
     with capture_stderr() as err:
         try:
             export_command(self.args)
         except SystemExit, ex:
             assert ex.code != 0
         else:
コード例 #4
0
ファイル: test_util_export.py プロジェクト: wkke/mapproxy
    def test_no_fetch_missing_tiles(self):
        self.args += [
            '--grid', 'GLOBAL_MERCATOR', '--dest', self.dest, '--levels', '0',
            '--source', 'tms_cache'
        ]
        with capture() as (out, err):
            export_command(self.args)

        eq_(os.listdir(self.dest), ['tile_locks'])
コード例 #5
0
ファイル: test_util_export.py プロジェクト: wkke/mapproxy
 def test_config_not_found(self):
     self.args = ['command_dummy', '-f', 'foo.bar']
     with capture() as (out, err):
         try:
             export_command(self.args)
         except SystemExit as ex:
             assert ex.code != 0
         else:
             assert False, 'export command did not exit'
     assert err.getvalue().startswith("ERROR:")
コード例 #6
0
ファイル: test_util_export.py プロジェクト: GeoDodo/mapproxy
 def test_config_not_found(self):
     self.args = ['command_dummy', '-f', 'foo.bar']
     with capture() as (out, err):
         try:
             export_command(self.args)
         except SystemExit as ex:
             assert ex.code != 0
         else:
             assert False, 'export command did not exit'
     assert err.getvalue().startswith("ERROR:")
コード例 #7
0
    def test_force(self):
        self.args += ['--grid', 'GLOBAL_MERCATOR', '--dest', self.dest,
            '--levels', '0', '--source', 'tms_cache']
        with capture_stderr():
            export_command(self.args)

        with capture_stderr():
            assert_raises(SystemExit, export_command, self.args)

        with capture_stderr():
            export_command(self.args + ['--force'])
コード例 #8
0
    def test_coverage(self):
        self.args += ['--grid', 'GLOBAL_MERCATOR', '--dest', self.dest,
            '--levels', '0..2', '--source', 'tms_cache', '--fetch-missing-tiles',
            '--coverage', '10,10,20,20', '--srs', 'EPSG:4326']
        with tile_server([(0, 0, 0), (1, 1, 1), (2, 2, 2)]):
            with capture_stderr():
                export_command(self.args)

        assert os.path.exists(os.path.join(self.dest, 'tile_locks'))
        assert os.path.exists(os.path.join(self.dest, '0', '0', '0.png'))
        assert os.path.exists(os.path.join(self.dest, '1', '1', '1.png'))
        assert os.path.exists(os.path.join(self.dest, '2', '2', '2.png'))
コード例 #9
0
    def test_fetch_missing_tiles(self):
        self.args += ['--grid', 'GLOBAL_MERCATOR', '--dest', self.dest,
            '--levels', '0,1', '--source', 'tms_cache', '--fetch-missing-tiles']
        with tile_server([(0, 0, 0), (0, 0, 1), (0, 1, 1), (1, 0, 1), (1, 1, 1)]):
            with capture_stderr():
                export_command(self.args)

        assert os.path.exists(os.path.join(self.dest, 'tile_locks'))
        assert os.path.exists(os.path.join(self.dest, '0', '0', '0.png'))
        assert os.path.exists(os.path.join(self.dest, '1', '0', '0.png'))
        assert os.path.exists(os.path.join(self.dest, '1', '0', '1.png'))
        assert os.path.exists(os.path.join(self.dest, '1', '1', '0.png'))
        assert os.path.exists(os.path.join(self.dest, '1', '1', '1.png'))
コード例 #10
0
    def test_custom_grid(self):
        self.args += ['--grid', 'base=GLOBAL_MERCATOR min_res=100000', '--dest', self.dest,
            '--levels', '1', '--source', 'tms_cache', '--fetch-missing-tiles']
        with tile_server([(0, 3, 2), (1, 3, 2), (2, 3, 2), (3, 3, 2),
                          (0, 2, 2), (1, 2, 2), (2, 2, 2), (3, 2, 2),
                          (0, 1, 2), (1, 1, 2), (2, 1, 2), (3, 1, 2),
                          (0, 0, 2), (1, 0, 2), (2, 0, 2), (3, 0, 2)]):
            with capture_stderr():
                export_command(self.args)

        assert os.path.exists(os.path.join(self.dest, 'tile_locks'))
        assert os.path.exists(os.path.join(self.dest, '1', '0', '0.png'))
        assert os.path.exists(os.path.join(self.dest, '1', '3', '3.png'))
コード例 #11
0
ファイル: test_util_export.py プロジェクト: wkke/mapproxy
    def test_force(self):
        self.args += [
            '--grid', 'GLOBAL_MERCATOR', '--dest', self.dest, '--levels', '0',
            '--source', 'tms_cache'
        ]
        with capture() as (out, err):
            export_command(self.args)

        with capture() as (out, err):
            assert_raises(SystemExit, export_command, self.args)

        with capture() as (out, err):
            export_command(self.args + ['--force'])
コード例 #12
0
ファイル: test_util_export.py プロジェクト: wkke/mapproxy
    def test_coverage(self):
        self.args += [
            '--grid', 'GLOBAL_MERCATOR', '--dest', self.dest, '--levels',
            '0..2', '--source', 'tms_cache', '--fetch-missing-tiles',
            '--coverage', '10,10,20,20', '--srs', 'EPSG:4326'
        ]
        with tile_server([(0, 0, 0), (1, 1, 1), (2, 2, 2)]):
            with capture() as (out, err):
                export_command(self.args)

        assert os.path.exists(os.path.join(self.dest, 'tile_locks'))
        assert os.path.exists(os.path.join(self.dest, '0', '0', '0.png'))
        assert os.path.exists(os.path.join(self.dest, '1', '1', '1.png'))
        assert os.path.exists(os.path.join(self.dest, '2', '2', '2.png'))
コード例 #13
0
    def test_no_fetch_missing_tiles(self):
        self.args += [
            "--grid",
            "GLOBAL_MERCATOR",
            "--dest",
            self.dest,
            "--levels",
            "0",
            "--source",
            "tms_cache",
        ]
        with capture() as (out, err):
            export_command(self.args)

        assert os.listdir(self.dest) == ["tile_locks"]
コード例 #14
0
 def test_invalid_grid_definition(self):
     self.args += [
         "--grid",
         "foo=1",
         "--dest",
         self.dest,
         "--levels",
         "0",
         "--source",
         "tms_cache",
     ]
     with capture() as (out, err):
         with pytest.raises(SystemExit):
             export_command(self.args)
         assert "foo" in err.getvalue()
コード例 #15
0
ファイル: test_util_export.py プロジェクト: wkke/mapproxy
    def test_fetch_missing_tiles(self):
        self.args += [
            '--grid', 'GLOBAL_MERCATOR', '--dest', self.dest, '--levels',
            '0,1', '--source', 'tms_cache', '--fetch-missing-tiles'
        ]
        with tile_server([(0, 0, 0), (0, 0, 1), (0, 1, 1), (1, 0, 1),
                          (1, 1, 1)]):
            with capture() as (out, err):
                export_command(self.args)

        assert os.path.exists(os.path.join(self.dest, 'tile_locks'))
        assert os.path.exists(os.path.join(self.dest, '0', '0', '0.png'))
        assert os.path.exists(os.path.join(self.dest, '1', '0', '0.png'))
        assert os.path.exists(os.path.join(self.dest, '1', '0', '1.png'))
        assert os.path.exists(os.path.join(self.dest, '1', '1', '0.png'))
        assert os.path.exists(os.path.join(self.dest, '1', '1', '1.png'))
コード例 #16
0
ファイル: test_util_export.py プロジェクト: wkke/mapproxy
    def test_custom_grid(self):
        self.args += [
            '--grid', 'base=GLOBAL_MERCATOR min_res=100000', '--dest',
            self.dest, '--levels', '1', '--source', 'tms_cache',
            '--fetch-missing-tiles'
        ]
        with tile_server([
            (0, 3, 2), (1, 3, 2), (2, 3, 2), (3, 3, 2), (0, 2, 2), (1, 2, 2),
            (2, 2, 2), (3, 2, 2), (0, 1, 2), (1, 1, 2), (2, 1, 2), (3, 1, 2),
            (0, 0, 2), (1, 0, 2), (2, 0, 2), (3, 0, 2)
        ]):
            with capture() as (out, err):
                export_command(self.args)

        assert os.path.exists(os.path.join(self.dest, 'tile_locks'))
        assert os.path.exists(os.path.join(self.dest, '1', '0', '0.png'))
        assert os.path.exists(os.path.join(self.dest, '1', '3', '3.png'))
コード例 #17
0
    def test_fetch_missing_tiles(self):
        self.args += [
            "--grid",
            "GLOBAL_MERCATOR",
            "--dest",
            self.dest,
            "--levels",
            "0,1",
            "--source",
            "tms_cache",
            "--fetch-missing-tiles",
        ]
        with tile_server([(0, 0, 0), (0, 0, 1), (0, 1, 1), (1, 0, 1), (1, 1, 1)]):
            with capture() as (out, err):
                export_command(self.args)

        assert os.path.exists(os.path.join(self.dest, "tile_locks"))
        assert os.path.exists(os.path.join(self.dest, "0", "0", "0.png"))
        assert os.path.exists(os.path.join(self.dest, "1", "0", "0.png"))
        assert os.path.exists(os.path.join(self.dest, "1", "0", "1.png"))
        assert os.path.exists(os.path.join(self.dest, "1", "1", "0.png"))
        assert os.path.exists(os.path.join(self.dest, "1", "1", "1.png"))
コード例 #18
0
    def test_custom_grid(self):
        self.args += [
            "--grid",
            "base=GLOBAL_MERCATOR min_res=100000",
            "--dest",
            self.dest,
            "--levels",
            "1",
            "--source",
            "tms_cache",
            "--fetch-missing-tiles",
        ]
        with tile_server(
            [
                (0, 3, 2),
                (1, 3, 2),
                (2, 3, 2),
                (3, 3, 2),
                (0, 2, 2),
                (1, 2, 2),
                (2, 2, 2),
                (3, 2, 2),
                (0, 1, 2),
                (1, 1, 2),
                (2, 1, 2),
                (3, 1, 2),
                (0, 0, 2),
                (1, 0, 2),
                (2, 0, 2),
                (3, 0, 2),
            ]
        ):
            with capture() as (out, err):
                export_command(self.args)

        assert os.path.exists(os.path.join(self.dest, "tile_locks"))
        assert os.path.exists(os.path.join(self.dest, "1", "0", "0.png"))
        assert os.path.exists(os.path.join(self.dest, "1", "3", "3.png"))
コード例 #19
0
    def test_coverage(self):
        self.args += [
            "--grid",
            "GLOBAL_MERCATOR",
            "--dest",
            self.dest,
            "--levels",
            "0..2",
            "--source",
            "tms_cache",
            "--fetch-missing-tiles",
            "--coverage",
            "10,10,20,20",
            "--srs",
            "EPSG:4326",
        ]
        with tile_server([(0, 0, 0), (1, 1, 1), (2, 2, 2)]):
            with capture() as (out, err):
                export_command(self.args)

        assert os.path.exists(os.path.join(self.dest, "tile_locks"))
        assert os.path.exists(os.path.join(self.dest, "0", "0", "0.png"))
        assert os.path.exists(os.path.join(self.dest, "1", "1", "1.png"))
        assert os.path.exists(os.path.join(self.dest, "2", "2", "2.png"))
コード例 #20
0
    def test_force(self):
        self.args += [
            "--grid",
            "GLOBAL_MERCATOR",
            "--dest",
            self.dest,
            "--levels",
            "0",
            "--source",
            "tms_cache",
        ]
        with capture() as (out, err):
            export_command(self.args)

        with capture() as (out, err):
            with pytest.raises(SystemExit):
                export_command(self.args)

        with capture() as (out, err):
            export_command(self.args + ["--force"])