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"]
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"]
def test_command_throws_with_invalid_type(self): with pytest.raises(ValueError): CmdArchiveExtract(ArchiveFormat("invalid")).validate()
def test_command_basics_auto(self): c = CmdArchiveExtract(ArchiveFormat.auto()) assert c.validate() assert "archive.auto_extract" == command_name(c)
def test_command_basics_tar(self): c = CmdArchiveExtract(ArchiveFormat.tar()) assert c.validate() assert "archive.targz_extract" == command_name(c)
def test_invalid_source_dir(self): c = CmdArchiveCreate(ArchiveFormat.zip()) with pytest.raises(TypeError): c.source_dir(42)
def test_invalid_target(self): c = CmdArchiveCreate(ArchiveFormat.zip()) with pytest.raises(TypeError): c.target(42)
def test_command_throws_with_invalid_type(self): with pytest.raises(ValueError): CmdArchiveCreate(ArchiveFormat.auto()).validate()
def test_command_basics_tar(self): c = CmdArchiveCreate(ArchiveFormat.tar()) assert c.validate() assert "archive.targz_pack" == command_name(c)
def test_command_basics_zip(self): c = CmdArchiveCreate(ArchiveFormat.zip()) assert c.validate() assert "archive.zip_pack" == command_name(c)