unit test for OAuth2