本文整理汇总了Python中dbbackup.management.commands.dbrestore.Command.unencrypt_file方法的典型用法代码示例。如果您正苦于以下问题:Python Command.unencrypt_file方法的具体用法?Python Command.unencrypt_file怎么用?Python Command.unencrypt_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dbbackup.management.commands.dbrestore.Command
的用法示例。
在下文中一共展示了Command.unencrypt_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DbrestoreCommandDecryptTest
# 需要导入模块: from dbbackup.management.commands.dbrestore import Command [as 别名]
# 或者: from dbbackup.management.commands.dbrestore.Command import unencrypt_file [as 别名]
class DbrestoreCommandDecryptTest(TestCase):
def setUp(self):
self.command = DbrestoreCommand()
self.command.passphrase = None
cmd = ('gpg --import %s' % GPG_PRIVATE_PATH).split()
subprocess.call(cmd, stdout=DEV_NULL, stderr=DEV_NULL)
@patch('dbbackup.management.commands.dbrestore.input', return_value=None)
@patch('dbbackup.management.commands.dbrestore.getpass', return_value=None)
def test_decrypt(self, *args):
if six.PY3:
self.skipTest("Decryption isn't implemented in Python3")
inputfile = open(ENCRYPTED_FILE, 'r+b')
uncryptfile = self.command.unencrypt_file(inputfile)
uncryptfile.seek(0)
self.assertEqual('foo\n', uncryptfile.read())