本文整理匯總了Python中passpie.crypt.Cryptor.check方法的典型用法代碼示例。如果您正苦於以下問題:Python Cryptor.check方法的具體用法?Python Cryptor.check怎麽用?Python Cryptor.check使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類passpie.crypt.Cryptor
的用法示例。
在下文中一共展示了Cryptor.check方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_passprase_check_with_ensure_raises_value_error_with_ensure
# 需要導入模塊: from passpie.crypt import Cryptor [as 別名]
# 或者: from passpie.crypt.Cryptor import check [as 別名]
def test_passprase_check_with_ensure_raises_value_error_with_ensure(self):
cryptor = Cryptor("path/to/database")
cryptor._import_keys = self.Mock()
cryptor._gpg.sign.return_value = None
passphrase = "passphrase"
with self.assertRaises(ValueError):
cryptor.check(passphrase, ensure=True)
示例2: test_passphrase_check_raises_value_error_when_bad_passphrase
# 需要導入模塊: from passpie.crypt import Cryptor [as 別名]
# 或者: from passpie.crypt.Cryptor import check [as 別名]
def test_passphrase_check_raises_value_error_when_bad_passphrase(self):
cryptor = Cryptor("path/to/database")
cryptor._import_keys = self.Mock()
passphrase = "passphrase"
result = cryptor.check(passphrase)
self.assertTrue(result)
self.assertTrue(cryptor._gpg.sign.called)
cryptor._gpg.sign.assert_called_once_with(
"testing",
default_key=cryptor.current_key,
passphrase=passphrase
)