Exemplo n.º 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'])
Exemplo n.º 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:
Exemplo n.º 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:
Exemplo n.º 4
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)

        eq_(os.listdir(self.dest), ['tile_locks'])
Exemplo n.º 5
0
 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:")
Exemplo n.º 6
0
 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:")
Exemplo n.º 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'])
Exemplo n.º 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'))
Exemplo n.º 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'))
Exemplo n.º 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'))
Exemplo n.º 11
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):
            assert_raises(SystemExit, export_command, self.args)

        with capture() as (out, err):
            export_command(self.args + ['--force'])
Exemplo n.º 12
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'))
Exemplo n.º 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"]
Exemplo n.º 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()
Exemplo n.º 15
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'))
Exemplo n.º 16
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'))
Exemplo n.º 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"))
Exemplo n.º 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"))
Exemplo n.º 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"))
Exemplo n.º 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"])