Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/core/tests/test_converters.py
Show All 25 Lines | def tmpfile_with_content(fromdir, contentfile): | ||||
return tmpfilepath | return tmpfilepath | ||||
def test_content_for_storage_path(tmpdir): | def test_content_for_storage_path(tmpdir): | ||||
# given | # given | ||||
data = b'temp file for testing content storage conversion' | data = b'temp file for testing content storage conversion' | ||||
tmpfile = tmpfile_with_content(tmpdir, data) | tmpfile = tmpfile_with_content(tmpdir, data) | ||||
obj = from_disk.Content.from_file(path=os.fsdecode(tmpfile), | obj = from_disk.Content.from_file(path=os.fsdecode(tmpfile)).get_data() | ||||
save_path=True).get_data() | |||||
expected_content = obj.copy() | expected_content = obj.copy() | ||||
expected_content['data'] = data | expected_content['data'] = data | ||||
expected_content['status'] = 'visible' | expected_content['status'] = 'visible' | ||||
del expected_content['path'] | del expected_content['path'] | ||||
del expected_content['perms'] | del expected_content['perms'] | ||||
expected_content = Content.from_dict(expected_content) | expected_content = Content.from_dict(expected_content) | ||||
▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines |