def test_decode_raises_for_invalid_token_error(self): with pytest.raises(werkzeug.exceptions.Unauthorized): with mock.patch('jwt.decode', side_effect=jwt.InvalidTokenError): self.auth.decode_token(None)