def test_MergeManifests_missing_files(): """Test that files that only appear in one manifest are not modified.""" d1 = dpack_pb2.DataPackage() f1 = d1.file.add() f1.relative_path = 'a' f1.comment = 'abc' d2 = dpack_pb2.DataPackage() f2 = d2.file.add() f2.relative_path = 'b' f2.comment = 'def' dpack.MergeManifests(d1, d2) assert d1.file[0].comment == 'abc' assert d2.file[0].comment == 'def'
def test_MergeManifests_comments(): """Test that comments from old manifests are copied to the new ones.""" d1 = dpack_pb2.DataPackage() f1 = d1.file.add() f1.relative_path = 'a' d2 = dpack_pb2.DataPackage() d2.comment = 'abc' f2 = d2.file.add() f2.comment = 'def' f2.relative_path = 'a' dpack.MergeManifests(d1, d2) assert d1.comment == d2.comment assert d1.file[0].comment == d2.file[0].comment
def test_MergeManifests_file_attributes(): """Test that file attributes are not merged.""" d1 = dpack_pb2.DataPackage() f1 = d1.file.add() f1.relative_path = 'a' f1.size_in_bytes = 1 f1.checksum_hash = dpack_pb2.SHA1 f1.checksum = 'abc' d2 = dpack_pb2.DataPackage() f2 = d2.file.add() f2.relative_path = 'a' f2.size_in_bytes = 2 f2.checksum_hash = dpack_pb2.MD5 f2.checksum = 'def' dpack.MergeManifests(d1, d2) assert d1.file[0].size_in_bytes == 1 assert d1.file[0].checksum_hash == dpack_pb2.SHA1 assert d1.file[0].checksum == 'abc'