Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/svn/tests/test_loader.py
Show First 20 Lines • Show All 1,070 Lines • ▼ Show 20 Lines | assert ( | ||||
== b"link ./file.txt" | == b"link ./file.txt" | ||||
) | ) | ||||
assert paths[b"external_link.txt"]["perms"] == DentryPerms.content | assert paths[b"external_link.txt"]["perms"] == DentryPerms.content | ||||
assert ( | assert ( | ||||
loader.storage.content_get_data(paths[b"external_link.txt"]["sha1"]) | loader.storage.content_get_data(paths[b"external_link.txt"]["sha1"]) | ||||
== b"link /home/user/data.txt" | == b"link /home/user/data.txt" | ||||
) | ) | ||||
def test_loader_svn_special_property_on_binary_file_with_null_bytes( | |||||
swh_storage, tmp_path | |||||
vlorentz: could you write a short docstring explaining why null bytes are an issue? | |||||
Done Inline Actionssure anlambert: sure | |||||
): | |||||
# create a repository | |||||
repo_path = os.path.join(tmp_path, "tmprepo") | |||||
repos.create(repo_path) | |||||
repo_url = f"file://{repo_path}" | |||||
data = ( | |||||
b"!<symlink>\xff\xfea\x00p\x00t\x00-\x00c\x00y\x00g\x00.\x00s\x00h\x00\x00\x00" | |||||
) | |||||
# first commit | |||||
add_commit( | |||||
repo_url, | |||||
("commit 1"), | |||||
[ | |||||
CommitChange( | |||||
change_type=CommitChangeType.AddOrUpdate, | |||||
path="binary_file", | |||||
properties={"svn:special": "*"}, | |||||
data=data, | |||||
), | |||||
], | |||||
) | |||||
# second commit | |||||
add_commit( | |||||
repo_url, | |||||
("commit 1"), | |||||
[ | |||||
CommitChange( | |||||
change_type=CommitChangeType.AddOrUpdate, | |||||
path="binary_file", | |||||
properties={"svn:special": None}, | |||||
), | |||||
], | |||||
) | |||||
# instantiate a svn loader checking after each processed revision that | |||||
# the repository filesystem it reconstructed does not differ from a subversion | |||||
# export of that revision | |||||
loader = SvnLoader( | |||||
swh_storage, repo_url, destination_path=tmp_path, check_revision=1 | |||||
) | |||||
assert loader.load() == {"status": "eventful"} | |||||
assert loader.visit_status() == "full" |
could you write a short docstring explaining why null bytes are an issue?