Esempio n. 1
0
    def test_parameters(self):
        c = CmdArchiveExtract(ArchiveFormat.zip())
        c.path("path").target("target").exclude("exclude 0").excludes(["exclude 1", "exclude 2"])

        p = params(c)

        assert "path" == p["path"]
        assert "target" == p["destination"]
        assert "exclude 0" in p["exclude_files"]
        assert "exclude 1" in p["exclude_files"]
        assert "exclude 2" in p["exclude_files"]
Esempio n. 2
0
    def test_parameters(self):
        c = CmdArchiveCreate(ArchiveFormat.zip())
        c.target("target").source_dir("src").include("include 0").includes(
            ["include 1", "include 2"]
        ).exclude("exclude 0").excludes(["exclude 1", "exclude 2"])

        p = params(c)

        assert "target" == p["target"]
        assert "src" == p["source_dir"]
        assert "include 0" in p["include"]
        assert "include 1" in p["include"]
        assert "include 2" in p["include"]
        assert "exclude 0" in p["exclude_files"]
        assert "exclude 1" in p["exclude_files"]
        assert "exclude 2" in p["exclude_files"]
Esempio n. 3
0
 def test_command_throws_with_invalid_type(self):
     with pytest.raises(ValueError):
         CmdArchiveExtract(ArchiveFormat("invalid")).validate()
Esempio n. 4
0
    def test_command_basics_auto(self):
        c = CmdArchiveExtract(ArchiveFormat.auto())

        assert c.validate()
        assert "archive.auto_extract" == command_name(c)
Esempio n. 5
0
    def test_command_basics_tar(self):
        c = CmdArchiveExtract(ArchiveFormat.tar())

        assert c.validate()
        assert "archive.targz_extract" == command_name(c)
Esempio n. 6
0
 def test_invalid_source_dir(self):
     c = CmdArchiveCreate(ArchiveFormat.zip())
     with pytest.raises(TypeError):
         c.source_dir(42)
Esempio n. 7
0
 def test_invalid_target(self):
     c = CmdArchiveCreate(ArchiveFormat.zip())
     with pytest.raises(TypeError):
         c.target(42)
Esempio n. 8
0
 def test_command_throws_with_invalid_type(self):
     with pytest.raises(ValueError):
         CmdArchiveCreate(ArchiveFormat.auto()).validate()
Esempio n. 9
0
    def test_command_basics_tar(self):
        c = CmdArchiveCreate(ArchiveFormat.tar())

        assert c.validate()
        assert "archive.targz_pack" == command_name(c)
Esempio n. 10
0
    def test_command_basics_zip(self):
        c = CmdArchiveCreate(ArchiveFormat.zip())

        assert c.validate()
        assert "archive.zip_pack" == command_name(c)