Fixed failing test

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
Václav Valíček 2022-07-27 13:37:32 +02:00
parent 2869ad2495
commit 8cbea5731e
Signed by: valicek
GPG Key ID: FF05BDCA0C73BB31
2 changed files with 11 additions and 5 deletions

@ -1 +1 @@
Subproject commit 2cd8137eeb96e2d23169d5728e9071b0ed663677 Subproject commit 3254380703607d4f632688e8ac8b3eec1eb69397

View File

@ -28,7 +28,6 @@ base_repo_branches = [
('release/7.7.8', '85003adc6bc0e91391edd97efb7f515cbd6d303e'), ('release/7.7.8', '85003adc6bc0e91391edd97efb7f515cbd6d303e'),
('release/7.7.9', '73aaf9a4377bab721ba716776e81dc76bec25beb'), ('release/7.7.9', '73aaf9a4377bab721ba716776e81dc76bec25beb'),
('symlink-readme', '8a2844f55fc1adde2e346d0999ef3e12aafbe511'), ('symlink-readme', '8a2844f55fc1adde2e346d0999ef3e12aafbe511'),
('temp', '72cab056e6a95fbb4e7ea3f0e1644a7eef345a2d'),
('v1/foo/bar', '6e3325f7dc37f67b48e719de1ce4a4c9d33d1042'), ('v1/foo/bar', '6e3325f7dc37f67b48e719de1ce4a4c9d33d1042'),
('v1/nix', 'c55e6953ff343f9eeb42dc04eb6aa5dfed6f0756')] ('v1/nix', 'c55e6953ff343f9eeb42dc04eb6aa5dfed6f0756')]
@ -209,15 +208,20 @@ def cloned_base_repo_obj(tmp_path: Path, path_repo_base: Path) -> RepoTool:
def prepare_collection_list(collection) -> list: def prepare_collection_list(collection) -> list:
result = [] result = []
items = {}
for item in collection: for item in collection:
result.append((item.name, str(item.commit))) items[item.name] = str(item.commit)
result.sort() keys = list(items.keys())
keys.sort()
for key in list(keys):
result.append((key, str(items[key])))
return result return result
def test_fetch_changed_branches(cloned_base_repo_obj: RepoTool, path_repo_changed_branches: Path): def test_fetch_changed_branches(cloned_base_repo_obj: RepoTool, path_repo_changed_branches: Path):
cloned_base_repo_obj._repo.remotes[0].set_url(path_repo_changed_branches.as_uri()) cloned_base_repo_obj._repo.remotes[0].set_url(path_repo_changed_branches.as_uri())
branches = prepare_collection_list(cloned_base_repo_obj._repo.branches) branches = prepare_collection_list(cloned_base_repo_obj._repo.branches)
assert branches == base_repo_branches assert branches == base_repo_branches
tags = prepare_collection_list(cloned_base_repo_obj._repo.tags) tags = prepare_collection_list(cloned_base_repo_obj._repo.tags)
@ -247,7 +251,7 @@ def test_fetch_changed_branches(cloned_base_repo_obj: RepoTool, path_repo_change
('release/7.7.9', '73aaf9a4377bab721ba716776e81dc76bec25beb'), ('release/7.7.9', '73aaf9a4377bab721ba716776e81dc76bec25beb'),
('v1/foo/bar', '6e3325f7dc37f67b48e719de1ce4a4c9d33d1042'), ('v1/foo/bar', '6e3325f7dc37f67b48e719de1ce4a4c9d33d1042'),
('v1/nix', '64ab804caa81c6a1c302cc03c3671d80f767c2c9'), ('v1/nix', '64ab804caa81c6a1c302cc03c3671d80f767c2c9'),
('wut', '558f12143c6d6d60690acb291cf64a863e12c2d0')] ('wut', '3254380703607d4f632688e8ac8b3eec1eb69397')]
tags = prepare_collection_list(cloned_base_repo_obj._repo.tags) tags = prepare_collection_list(cloned_base_repo_obj._repo.tags)
assert tags == [ assert tags == [
@ -276,6 +280,8 @@ def test_fetch_diferent_tags(cloned_base_repo_obj: RepoTool, path_repo_different
assert cloned_base_repo_obj.fetch() assert cloned_base_repo_obj.fetch()
print(branches)
branches = prepare_collection_list(cloned_base_repo_obj._repo.branches) branches = prepare_collection_list(cloned_base_repo_obj._repo.branches)
assert branches == [ assert branches == [
('br0', '1fe320fe278a40bfd6813860d9952b03caf5e2ea'), ('br0', '1fe320fe278a40bfd6813860d9952b03caf5e2ea'),