~stepankk/pyopenssl/bug-845445

« back to all changes in this revision

Viewing changes to OpenSSL/test/test_crypto.py

  • Committer: Jean-Paul Calderone
  • Date: 2011-09-14 15:02:05 UTC
  • mto: This revision was merged to the branch mainline in revision 161.
  • Revision ID: exarkun@divmod.com-20110914150205-3v50kd54rlgpalkt
Python 3.x compatibility

Show diffs side-by-side

added added

removed removed

Lines of Context:
2016
2016
 
2017
2017
    def test_load_privatekey_wrongPassphraseCallback(self):
2018
2018
        """
2019
 
        :py:obj:`load_privatekey` raises :py:obj:`OpenSSL.crypto.Error` when it is passed an
2020
 
        encrypted PEM and a passphrase callback which returns an incorrect
2021
 
        passphrase.
 
2019
        :py:obj:`load_privatekey` raises :py:obj:`OpenSSL.crypto.Error` when it
 
2020
        is passed an encrypted PEM and a passphrase callback which returns an
 
2021
        incorrect passphrase.
2022
2022
        """
2023
2023
        called = []
2024
2024
        def cb(*a):
2025
2025
            called.append(None)
2026
 
            return "quack"
 
2026
            return b("quack")
2027
2027
        self.assertRaises(
2028
2028
            Error,
2029
2029
            load_privatekey, FILETYPE_PEM, encryptedPrivateKeyPEM, cb)