def test_problematic_paths(self): for path in PROBLEMATIC_PATHS: encrypted_path = encrypt_path(path, self.key) decrypted_path = decrypt_path(encrypted_path, self.key) self.assertEqual(path, decrypted_path, "Decrypted path %s not equal to original path %s, encrypted version =%s, key=%s" % (decrypted_path, path, encrypted_path, self.key))
def test_walk(self): bp = unicode(BASE_PATH) for root, dirnames, filenames in os.walk(bp): for filename in filenames: fpath = os.path.join(unicode(root), unicode(filename)) #print "Path = %s" % fpath.encode("utf-8") encrypted_path = encrypt_path(fpath, self.key) decrypted_path = decrypt_path(encrypted_path, self.key) self.assertEqual(fpath, decrypted_path, "Decrypted path %s not equal to original path %s, encrypted version =%s, key=%s" % (decrypted_path, fpath, encrypted_path, self.key))