def verify(self, msg, sig, key): import sys if sys.version < '3': if sig == 'u mad?' + key: return '<trollface>' else: if sig == b'u mad?' + bytes(key, 'UTF-8'): return '<trollface>' raise jws.SignatureError('Y U NO GIVE GOOD SIGNATURE')
def verify(self, msg, sig, key): if sig == 'u mad?' + key: return '<trollface>' raise jws.SignatureError('Y U NO GIVE GOOD SIGNATURE')
def test_invalid_hmac(self): header = {'alg': 'HS512'} sinput, sig = jws.sign(header, self.payload, 'secret') self.assertRaises( jws.SignatureError(header, self.payload, sig, 'failwhale'))