def test_aes_decode_with_invalid_password(self):
        """pw_decode raises an Exception when supplied an invalid password."""
        payload = u"blah"
        password = u"uber secret"
        wrong_password = u"not the password"
        for version in SUPPORTED_PW_HASH_VERSIONS:
            enc = crypto.pw_encode(payload, password, version=version)
            with self.assertRaises(InvalidPassword):
                crypto.pw_decode(enc, wrong_password, version=version)
        # sometimes the PKCS7 padding gets removed cleanly,
        # but then UnicodeDecodeError gets raised (internally):
        enc = 'smJ7j6ccr8LnMOlx98s/ajgikv9s3R1PQuG3GyyIMmo='
        with self.assertRaises(InvalidPassword):
            crypto.pw_decode(enc, wrong_password, version=1)
pw_decode raises an Exception when supplied an invalid password.
tests/test_bitcoin.py