Exemplo n.º 1
0
def test_noace_plain():
    assert "ACE archive" in f("ace_plain.ace").magic
    t = AceFile(f("ace_plain.ace"))
    assert t.handles() is True

    with pytest.raises(UnpackException):
        t.unpack()
Exemplo n.º 2
0
 def test_garbage(self):
     t = AceFile(f("garbage.bin"))
     assert t.handles() is False
     assert not t.f.selected
     with pytest.raises(UnpackException) as e:
         t.unpack()
     assert e.value.state == Errors.NOTHING_EXTRACTED
Exemplo n.º 3
0
 def test_ace_plain(self):
     assert "ACE archive" in f("ace_plain.ace").magic
     t = AceFile(f("ace_plain.ace"))
     assert t.handles() is True
     assert not t.f.selected
     files = list(t.unpack())
     assert len(files) == 1
     assert files[0].relapath == "ace.txt"
     assert files[0].contents == "wow .ace"
     assert "ASCII text" in files[0].magic
     assert files[0].parentdirs == []
     assert not files[0].selected
Exemplo n.º 4
0
 def test_ace_plain(self):
     assert "ACE archive" in f("ace_plain.ace").magic
     t = AceFile(f("ace_plain.ace"))
     assert t.handles() is True
     assert not t.f.selected
     files = list(t.unpack())
     assert len(files) == 1
     assert files[0].relapath == "ace.txt"
     assert files[0].contents == "wow .ace"
     assert "ASCII text" in files[0].magic
     assert files[0].parentdirs == []
     assert not files[0].selected
Exemplo n.º 5
0
    def test_nested2_plain(self):
        assert "ACE archive" in f("ace_nested2.ace").magic
        t = AceFile(f("ace_nested2.ace"))
        assert t.handles() is True
        assert not t.f.selected
        files = list(t.unpack())
        assert len(files) == 1

        assert files[0].relapath == "derp/b00/ace.txt"
        assert files[0].parentdirs == ["derp", "b00"]
        assert files[0].contents == b"wow .ace"
        assert not files[0].password
        assert "ASCII text" in files[0].magic
        assert not files[0].selected
Exemplo n.º 6
0
    def test_nested2_plain(self):
        assert "ACE archive" in f("ace_nested2.ace").magic
        t = AceFile(f("ace_nested2.ace"))
        assert t.handles() is True
        files = list(t.unpack())
        assert len(files) == 1

        assert files[0].filepath == "derp/b00/ace.txt"
        assert files[0].parentdirs == ["derp", "b00"]
        assert files[0].contents == "wow .ace"
        assert not files[0].password
        assert "ASCII text" in files[0].magic

        s = f("ace_nested2.ace").get_signature()
        assert s is None
Exemplo n.º 7
0
    def test_ace_plain(self):
        assert "ACE archive" in f("ace_plain.ace").magic
        t = AceFile(f("ace_plain.ace"))
        assert t.handles() is True
        files = list(t.unpack())
        assert len(files) == 1
        assert files[0].filepath == "ace.txt"
        assert files[0].contents == "wow .ace"
        assert "ASCII text" in files[0].magic
        assert files[0].parentdirs == []

        # TODO A combination of file extension, file magic, and initial bytes
        # signature should be used instead of just the bytes (as this call
        # should not yield None).
        assert f("ace_plain.ace").get_signature() is None
Exemplo n.º 8
0
def test_count_supported():
    count = 15

    if AceFile(None).supported():
        count += 1

    if CabFile(None).supported():
        count += 1

    if RarFile(None).supported():
        count += 1

    if Zip7File(None).supported():
        count += 7

    assert count == len(supported())
Exemplo n.º 9
0
def test_count_supported():
    count = 10

    if DaaFile(None).supported():
        count += 1

    if VHDFile(None).supported():
        count += 2

    if AceFile(None).supported():
        count += 1

    if CabFile(None).supported():
        count += 1

    if RarFile(None).supported():
        count += 1

    if Zip7File(None).supported():
        count += 5

    assert count == len(supported())
Exemplo n.º 10
0
def test_noace_plain():
    assert "ACE archive" in f("ace_plain.ace").magic
    t = AceFile(f("ace_plain.ace"))
    assert t.handles() is True
    assert not t.f.selected
Exemplo n.º 11
0
 def test_garbage(self):
     t = AceFile(f("garbage.bin"))
     assert t.handles() is False
     assert not t.f.selected
     assert not t.unpack()
     assert t.f.mode == "failed"
Exemplo n.º 12
0
 def test_doubledot(self):
     files = list(AceFile(f("ace_doubledot.ace")).unpack())
     assert len(files) == 1
     assert files[0].filename == (
         "Procurement commercial terms & conditions..exe")
Exemplo n.º 13
0
def test_noace_plain():
    assert "ACE archive" in f("ace_plain.ace").magic
    t = AceFile(f("ace_plain.ace"))
    assert t.handles() is True
    assert not t.f.selected
Exemplo n.º 14
0
 def test_garbage(self):
     t = AceFile(f("garbage.bin"))
     assert t.handles() is False
     assert not t.f.selected
     assert not t.unpack()
     assert t.f.mode == "failed"
Exemplo n.º 15
0
    def test_garbage(self):
        t = AceFile(f("garbage.bin"))
        assert t.handles() is False

        with pytest.raises(UnpackException):
            t.unpack()