95
100
self.assertEqual(['test/' + fname.encode('utf8')],
96
101
sorted(zfile.namelist()))
103
def test_zip_export_directories(self):
104
tree = self.make_branch_and_tree('zip')
105
self.build_tree(['zip/a', 'zip/b/', 'zip/b/c', 'zip/d/'])
106
tree.add(['a', 'b', 'b/c', 'd'])
110
self.run_bzr('export', 'test.zip')
111
zfile = zipfile.ZipFile('test.zip')
112
names = sorted(zfile.namelist())
114
# even on win32, zipfile.ZipFile changes all names to use
116
self.assertEqual(['test/a', 'test/b/', 'test/b/c', 'test/d/'], names)
118
file_attr = stat.S_IFREG
119
dir_attr = stat.S_IFDIR | zip_exporter.ZIP_DIRECTORY_BIT
121
a_info = zfile.getinfo(names[0])
122
self.assertEqual(file_attr, a_info.external_attr)
124
b_info = zfile.getinfo(names[1])
125
self.assertEqual(dir_attr, b_info.external_attr)
127
c_info = zfile.getinfo(names[2])
128
self.assertEqual(file_attr, c_info.external_attr)
130
d_info = zfile.getinfo(names[3])
131
self.assertEqual(dir_attr, d_info.external_attr)
98
133
def test_dir_export(self):
99
134
tree = self.make_branch_and_tree('dir')
100
135
self.build_tree(['dir/a'])