Mike Stipicevic
Mike Stipicevic

Reputation: 31

how to write cloud endpoints unittests with authentication?

I'm writing unittests (using webtest) for a Cloud Endpoints API written in python. One of these methods requires authentication. I've set USER_ID, USER_EMAIL and USER_IS_ADMIN with testbed.setup_env(), but that doesn't seem to work. What's the best way to mock authentication for endpoints unittests?

Upvotes: 2

Views: 72

Answers (1)

Mike Stipicevic
Mike Stipicevic

Reputation: 31

Turns out the correct answer is to mock out endpoints.get_current_user() and possibly oauth.is_current_user_admin()!

Upvotes: 1

Related Questions