def test_list_archive_content_on_split_encrypted_archive(capsys, setup_gpg):
    archive_file = get_directory_with_name(
        "split-encrypted-archive") / "large-folder.part3.tar.lz.gpg"
    expected_listing = get_listing_with_name("listing-split-part3.lst")

    create_file_listing_and_assert_output_equals(archive_file,
                                                 expected_listing, capsys)
def test_list_archive_content_subpath_split(capsys):
    archive_dir = get_directory_with_name("split-archive")
    expected_listing = get_listing_with_name("listing-split-partial.lst")

    create_file_listing_and_assert_output_equals(archive_dir, expected_listing,
                                                 capsys,
                                                 "large-folder/subfolder")
def test_list_archive_content_on_archive(capsys):
    archive_file = get_directory_with_name(
        "normal-archive") / "test-folder.tar.lz"
    expected_listing = get_listing_with_name("listing-full.lst")

    create_file_listing_and_assert_output_equals(archive_file,
                                                 expected_listing, capsys)
def test_list_archive_content_on_encrypted_archive(capsys, setup_gpg):
    archive_file = get_directory_with_name(
        "encrypted-archive") / "test-folder.tar.lz.gpg"
    expected_listing = get_listing_with_name("listing-full.lst")

    create_file_listing_and_assert_output_equals(archive_file,
                                                 expected_listing, capsys)
def test_list_archive_content_deep_on_split_encrypted_directory(
        capsys, setup_gpg):
    archive_dir = get_directory_with_name("split-encrypted-archive")
    expected_listing = get_listing_with_name("listing-split-deep.lst")

    create_file_listing_and_assert_output_equals(archive_dir, expected_listing,
                                                 capsys, None, DEEP)
def test_list_archive_content_deep_subpath_encrypted_split(capsys, setup_gpg):
    archive_dir = get_directory_with_name("split-encrypted-archive")
    expected_listing = get_listing_with_name("listing-split-partial-deep.lst")

    create_file_listing_and_assert_output_equals(archive_dir, expected_listing,
                                                 capsys,
                                                 "large-folder/subfolder",
                                                 DEEP)
def test_list_archive_content_deep_encrypted_subpath(capsys, setup_gpg):
    archive_file = get_directory_with_name(
        "encrypted-archive") / "test-folder.tar.lz.gpg"
    expected_listing = get_listing_with_name("listing-partial-deep.lst")

    create_file_listing_and_assert_output_equals(
        archive_file, expected_listing, capsys,
        "test-folder/folder-in-archive", DEEP)
def test_parse_tar_listing(listing_name):
    listing_path = get_listing_with_name(listing_name)

    listing = parse_tar_listing(listing_path)

    assert len(listing) == 8
    assert all(e.owner == 'marc' for e in listing)
    assert all(e.group == 'staff' for e in listing)
    assert all(int(e.size) >= 0 for e in listing)
    assert listing[-1].link_target == '../file1.txt'
    paths = {e.path for e in listing}
    assert 'symlink-folder/folder with\ttab/file2.txt' in paths
def test_list_archive_content_on_directory(capsys):
    archive_dir = get_directory_with_name("normal-archive")
    expected_listing = get_listing_with_name("listing-full.lst")

    create_file_listing_and_assert_output_equals(archive_dir, expected_listing,
                                                 capsys)
def test_list_archive_content_subpath_encrypted(capsys, setup_gpg):
    archive_dir = get_directory_with_name("encrypted-archive")
    expected_listing = get_listing_with_name("listing-partial.lst")

    create_file_listing_and_assert_output_equals(
        archive_dir, expected_listing, capsys, "test-folder/folder-in-archive")
def test_list_archive_content_symlink_deep(capsys):
    archive_dir = get_directory_with_name("symlink-archive")
    expected_listing = get_listing_with_name("listing-symlink-deep.lst")

    create_file_listing_and_assert_output_equals(archive_dir, expected_listing,
                                                 capsys, None, DEEP)