|
@@ -106,7 +106,7 @@ class ArchiverTestCaseBase(AtticTestCase):
|
|
|
|
|
|
class ArchiverTestCase(ArchiverTestCaseBase):
|
|
class ArchiverTestCase(ArchiverTestCaseBase):
|
|
|
|
|
|
- def create_regual_file(self, name, size=0):
|
|
|
|
|
|
+ def create_regular_file(self, name, size=0):
|
|
filename = os.path.join(self.input_path, name)
|
|
filename = os.path.join(self.input_path, name)
|
|
if not os.path.exists(os.path.dirname(filename)):
|
|
if not os.path.exists(os.path.dirname(filename)):
|
|
os.makedirs(os.path.dirname(filename))
|
|
os.makedirs(os.path.dirname(filename))
|
|
@@ -117,11 +117,11 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
|
"""Create a minimal test case including all supported file types
|
|
"""Create a minimal test case including all supported file types
|
|
"""
|
|
"""
|
|
# File
|
|
# File
|
|
- self.create_regual_file('empty', size=0)
|
|
|
|
- self.create_regual_file('file1', size=1024 * 80)
|
|
|
|
- self.create_regual_file('flagfile', size=1024)
|
|
|
|
|
|
+ self.create_regular_file('empty', size=0)
|
|
|
|
+ self.create_regular_file('file1', size=1024 * 80)
|
|
|
|
+ self.create_regular_file('flagfile', size=1024)
|
|
# Directory
|
|
# Directory
|
|
- self.create_regual_file('dir2/file2', size=1024 * 80)
|
|
|
|
|
|
+ self.create_regular_file('dir2/file2', size=1024 * 80)
|
|
# File owner
|
|
# File owner
|
|
os.chown('input/file1', 100, 200)
|
|
os.chown('input/file1', 100, 200)
|
|
# File mode
|
|
# File mode
|
|
@@ -163,10 +163,10 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
|
|
|
|
|
def test_extract_include_exclude(self):
|
|
def test_extract_include_exclude(self):
|
|
self.attic('init', self.repository_location)
|
|
self.attic('init', self.repository_location)
|
|
- self.create_regual_file('file1', size=1024 * 80)
|
|
|
|
- self.create_regual_file('file2', size=1024 * 80)
|
|
|
|
- self.create_regual_file('file3', size=1024 * 80)
|
|
|
|
- self.create_regual_file('file4', size=1024 * 80)
|
|
|
|
|
|
+ self.create_regular_file('file1', size=1024 * 80)
|
|
|
|
+ self.create_regular_file('file2', size=1024 * 80)
|
|
|
|
+ self.create_regular_file('file3', size=1024 * 80)
|
|
|
|
+ self.create_regular_file('file4', size=1024 * 80)
|
|
self.attic('create', '--exclude=input/file4', self.repository_location + '::test', 'input')
|
|
self.attic('create', '--exclude=input/file4', self.repository_location + '::test', 'input')
|
|
with changedir('output'):
|
|
with changedir('output'):
|
|
self.attic('extract', self.repository_location + '::test', 'input/file1', )
|
|
self.attic('extract', self.repository_location + '::test', 'input/file1', )
|
|
@@ -180,7 +180,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
|
|
|
|
|
def test_path_normalization(self):
|
|
def test_path_normalization(self):
|
|
self.attic('init', self.repository_location)
|
|
self.attic('init', self.repository_location)
|
|
- self.create_regual_file('dir1/dir2/file', size=1024 * 80)
|
|
|
|
|
|
+ self.create_regular_file('dir1/dir2/file', size=1024 * 80)
|
|
with changedir('input/dir1/dir2'):
|
|
with changedir('input/dir1/dir2'):
|
|
self.attic('create', self.repository_location + '::test', '../../../input/dir1/../dir1/dir2/..')
|
|
self.attic('create', self.repository_location + '::test', '../../../input/dir1/../dir1/dir2/..')
|
|
output = self.attic('list', self.repository_location + '::test')
|
|
output = self.attic('list', self.repository_location + '::test')
|
|
@@ -188,13 +188,13 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
|
self.assert_in(' input/dir1/dir2/file', output)
|
|
self.assert_in(' input/dir1/dir2/file', output)
|
|
|
|
|
|
def test_repeated_files(self):
|
|
def test_repeated_files(self):
|
|
- self.create_regual_file('file1', size=1024 * 80)
|
|
|
|
|
|
+ self.create_regular_file('file1', size=1024 * 80)
|
|
self.attic('init', self.repository_location)
|
|
self.attic('init', self.repository_location)
|
|
self.attic('create', self.repository_location + '::test', 'input', 'input')
|
|
self.attic('create', self.repository_location + '::test', 'input', 'input')
|
|
|
|
|
|
def test_overwrite(self):
|
|
def test_overwrite(self):
|
|
- self.create_regual_file('file1', size=1024 * 80)
|
|
|
|
- self.create_regual_file('dir2/file2', size=1024 * 80)
|
|
|
|
|
|
+ self.create_regular_file('file1', size=1024 * 80)
|
|
|
|
+ self.create_regular_file('dir2/file2', size=1024 * 80)
|
|
self.attic('init', self.repository_location)
|
|
self.attic('init', self.repository_location)
|
|
self.attic('create', self.repository_location + '::test', 'input')
|
|
self.attic('create', self.repository_location + '::test', 'input')
|
|
# Overwriting regular files and directories should be supported
|
|
# Overwriting regular files and directories should be supported
|
|
@@ -212,8 +212,8 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
|
self.attic('extract', self.repository_location + '::test', exit_code=1)
|
|
self.attic('extract', self.repository_location + '::test', exit_code=1)
|
|
|
|
|
|
def test_delete(self):
|
|
def test_delete(self):
|
|
- self.create_regual_file('file1', size=1024 * 80)
|
|
|
|
- self.create_regual_file('dir2/file2', size=1024 * 80)
|
|
|
|
|
|
+ self.create_regular_file('file1', size=1024 * 80)
|
|
|
|
+ self.create_regular_file('dir2/file2', size=1024 * 80)
|
|
self.attic('init', self.repository_location)
|
|
self.attic('init', self.repository_location)
|
|
self.attic('create', self.repository_location + '::test', 'input')
|
|
self.attic('create', self.repository_location + '::test', 'input')
|
|
self.attic('create', self.repository_location + '::test.2', 'input')
|
|
self.attic('create', self.repository_location + '::test.2', 'input')
|
|
@@ -249,7 +249,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
|
os.system('chmod -R u+w ' + self.repository_path)
|
|
os.system('chmod -R u+w ' + self.repository_path)
|
|
|
|
|
|
def test_cmdline_compatibility(self):
|
|
def test_cmdline_compatibility(self):
|
|
- self.create_regual_file('file1', size=1024 * 80)
|
|
|
|
|
|
+ self.create_regular_file('file1', size=1024 * 80)
|
|
self.attic('init', self.repository_location)
|
|
self.attic('init', self.repository_location)
|
|
self.attic('create', self.repository_location + '::test', 'input')
|
|
self.attic('create', self.repository_location + '::test', 'input')
|
|
output = self.attic('verify', '-v', self.repository_location + '::test')
|
|
output = self.attic('verify', '-v', self.repository_location + '::test')
|