def test_fileobj_ops(self): """Test fileobj operations""" if not self.url_string: print "No URL for test %s...skipping... " % self.my_test_id, return 0 config.set_environ("FTP_PASSWORD", self.password) self.try_fileobj_ops(duplicity.backend.get_backend(self.url_string))
def del_tmp(self): """Remove all files from test directory""" config.set_environ("FTP_PASSWORD", self.password) backend = duplicity.backend.get_backend(self.url_string) backend.delete(backend.list()) backend.close() """Delete and create testfiles/output""" assert not os.system("rm -rf testfiles/output") assert not os.system("mkdir testfiles/output")
def test_asym_cycle(self): """Like test_basic_cycle but use asymmetric encryption and signing""" backup_options = ["--encrypt-key " + config.encrypt_key1, "--sign-key " + config.sign_key] restore_options = ["--encrypt-key " + config.encrypt_key1, "--sign-key " + config.sign_key] config.set_environ("SIGN_PASSPHRASE", config.sign_passphrase) self.test_basic_cycle(backup_options = backup_options, restore_options = restore_options)
def test_asym_cycle(self): """Like test_basic_cycle but use asymmetric encryption and signing""" backup_options = [ "--encrypt-key " + config.encrypt_key1, "--sign-key " + config.sign_key ] restore_options = [ "--encrypt-key " + config.encrypt_key1, "--sign-key " + config.sign_key ] config.set_environ("SIGN_PASSPHRASE", config.sign_passphrase) self.test_basic_cycle(backup_options=backup_options, restore_options=restore_options)
cookies=self.cookies) index = index.text.encode('iso-8859-1').decode('gbk') pat = '共發表帖子: \d{1,5}' num = re.search(pat, index).group(0) num = num.replace('共發表帖子: ', '') return num def debug(self, content): self.logger.debug(content) if __name__ == "__main__": n = 0 success = None suc = False config.set_environ() user = os.environ["USER"] password = os.environ["PASSWORD"] secret = os.environ["SECRET"] auto = Autoreply(user, password, secret) while success is None: au = auto.login1() if au == '登录尝试次数过多,需输入验证码': auto.debug('登录尝试次数过多,需输入验证码') auto.getverwebp() getcd = Getver() vercode = getcd.getcode() auto.debug(vercode) while auto.inputvercode(vercode) == '验证码不正确,请重新输入': auto.debug('验证码不正确,请重新输入')