def test_file_entry_no_stat_info(): file_path = os.path.join(temp_dir, '0') stat_info = StatInfo.for_file(file_path) expected = FileEntry(file_path, "12345", stat_info) assert_really_equal(expected, FileEntry(file_path, "12345"))
def csv_row_for(i): filename = os.path.join(temp_dir, str(i)) stat_info = StatInfo.for_file(filename) content = "This is content number {}".format(i) object_id = "data/{}/{}".format(sha1sum(str(i)), sha1sum(content)) return "{}:{}:{}".format(filename, object_id, ":".join(str(field) for field in stat_info))
def test_file_entry_as_fields(): filename = os.path.join(temp_dir, '0') entry = FileEntry(filename, "data/{}/{}".format(sha1sum('0'), sha1sum("This is content number 0"))) stat_info = StatInfo.for_file(filename) expected = (filename, "data/{}/{}".format(sha1sum('0'), sha1sum("This is content number 0"))) + stat_info assert_really_equal(expected, entry.as_fields())
def test_file_entry_no_checksum(): file_path = os.path.join(temp_dir, '0') stat_info = StatInfo.for_file(file_path) FileEntry(file_path, None, stat_info)
def test_file_entry_no_path(): file_path = os.path.join(temp_dir, '0') stat_info = StatInfo.for_file(file_path) FileEntry(None, "12345", stat_info)
def expected_file_entry_for(i): filename = os.path.join(temp_dir, str(i)) content = "This is content number {}".format(i) return FileEntry(filename, "data/{}/{}".format(sha1sum(str(i)), sha1sum(content)), StatInfo.for_file(filename))
def test_stat_info_no_path(): StatInfo.for_file(None)