def setUp(self): unittest.TestCase.setUp(self) self.filedrive = "/tmp/drive.crypto" self.mountpoint = "/tmp/drivetest" self.truecrypt = TrueCrypt(self.filedrive, self.mountpoint) self.password = '******' self.new_password = "******" self.fileback = '/tmp/drive.crypto.back'
def setUp(self): unittest.TestCase.setUp(self) self.filedrive = "/tmp/drive.crypto" self.mountpoint = "/tmp/drivetest" self.truecrypt = TrueCrypt(self.filedrive, self.mountpoint) self.password = '******' self.new_password = "******" self.fileback = '/tmp/drive.crypto.back'
class TrueCryptTest(unittest.TestCase): def setUp(self): unittest.TestCase.setUp(self) self.filedrive = "/tmp/drive.crypto" self.mountpoint = "/tmp/drivetest" self.truecrypt = TrueCrypt(self.filedrive, self.mountpoint) self.password = '******' self.new_password = "******" self.fileback = '/tmp/drive.crypto.back' def test_1_create_drive(self): r = self.truecrypt.create(self.password) self.assertTrue(r) def test_get_popen(self): popen = self.truecrypt._get_popen(["echo","test"]) stdout, stdin = popen.communicate() self.assertEqual( stdout, 'test\n') def test_generate_list(self): genlist = self.truecrypt._generate_list("create", self.password, self.filedrive) cmd = " ".join(genlist) self.assertEqual( cmd, truecrypt.COMMANDS['create'] % ( self.password, self.filedrive)) def test_2_1_mount_drive(self): try: os.mkdir(self.mountpoint) except OSError, e: pass #silent file exists r = self.truecrypt.mount(self.password) self.assertTrue(r)