Changeset View
Changeset View
Standalone View
Standalone View
swh/scanner/tests/test_model.py
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | def test_get_json_tree_only_one_present(example_tree, temp_folder): | ||||
for path, swhid in temp_folder["paths"].items(): | for path, swhid in temp_folder["paths"].items(): | ||||
example_tree.add_node(path, swhid, True if path == filesample_path else False) | example_tree.add_node(path, swhid, True if path == filesample_path else False) | ||||
result = example_tree.to_dict() | result = example_tree.to_dict() | ||||
assert len(result) == 6 | assert len(result) == 6 | ||||
for path, node_attr in result.items(): | for path, node_attr in result.items(): | ||||
if path == str(root) + "/subdir0/filesample.txt": | if path == str(root) + "/subdir/filesample.txt": | ||||
assert node_attr["known"] is True | assert node_attr["known"] is True | ||||
else: | else: | ||||
assert node_attr["known"] is False | assert node_attr["known"] is False | ||||
def test_get_directories_info(example_tree, temp_folder): | def test_get_directories_info(example_tree, temp_folder): | ||||
root_path = temp_folder["root"] | root_path = temp_folder["root"] | ||||
filesample_path = temp_folder["filesample"] | filesample_path = temp_folder["filesample"] | ||||
Show All 40 Lines |