from testing.test_deltatar import (DeltaTarTest, DeltaTar2Test,
DeltaTarStreamTest, DeltaTarGzipTest, DeltaTarGzipStreamTest,
DeltaTarGzipConcatTest, DeltaTarGzipAes128ConcatTest,
- DeltaTarAes128ConcatTest
+ DeltaTarAes128ConcatTest,
+ DeltaTarFilesystemHandlingTest
)
from testing.test_compression_level import suite
GIT_DIR = '.git'
+ FSTEST = None
+ FSAPI_SAVED = []
+
def setUp(self):
'''
Create base test data
if not os.path.isdir(self.GIT_DIR):
raise Exception('No input directory found: ' + self.GIT_DIR)
+ if self.FSTEST is not None:
+ self.FSTEST ()
+
def tearDown(self):
'''
- Remove temporal files created by unit tests and reset globals.
+ Remove temporary files created by unit tests and restore the API
+ functions in *os*.
'''
+ for att, val in self.FSAPI_SAVED:
+ setattr (os, att, val)
os.chdir(self.pwd)
os.system("rm -rf source_dir target_dir source_dir* backup_dir* huge")
_ = crypto._testing_set_PDTCRYPT_MAX_OBJ_SIZE \
fullpath = os.path.join("source_dir", testpath)
assert not os.path.exists(fullpath)
+
+def fsapi_access_true (self):
+ """
+ Chicanery for testing improper use of the *os* module.
+ """
+ def yes (*_a, **_ka): return True
+ self.FSAPI_SAVED.append (("access", getattr (os, "access")))
+ setattr (os, "access", yes)
+
+
class DeltaTar2Test(DeltaTarTest):
'''
Same as DeltaTar but with specific ":" mode
ENCRYPTION = ('some magic key', 1)
+class DeltaTarFilesystemHandlingTest(DeltaTarGzipTest):
+ '''
+ Mess with filesystem APIs.
+ '''
+ FSTEST = fsapi_access_true
+