def test_verify_sig(app): """Test that token is verified.""" payload = dict(foo=1) t = _jwt_encode(payload) old_key = app.secret_key try: app.secret_key = 'foo' with pytest.raises(jwt.exceptions.DecodeError): _jwt_decode(t) finally: app.secret_key = old_key
def test_token_has_exp(app): """Test that token has exp field in payload.""" payload = dict(foo=1) t = _jwt_encode(payload) p = _jwt_decode(t) assert 'exp' in p
def test_token_enc_dec(app): """Test basic encoding and decoding of token.""" payload = dict(foo=1) t = _jwt_encode(payload) p = _jwt_decode(t) assert p['foo'] == 1