def test_get_user_returns_none_if_no_client(self): # Setup. user = user_models.User.create('*****@*****.**', 'qwerty') user.put() request = mock.MagicMock() # Exercise. loaded_user = oauth_api.get_user('*****@*****.**', 'qwerty', None, request) # Verify self.assertEqual(None, loaded_user)
def test_get_user_returns_existing_user(self): # Setup. user = user_models.User.create('*****@*****.**', 'qwerty') user.put() request = mock.MagicMock() # Exercise. loaded_user = oauth_api.get_user('*****@*****.**', 'qwerty', self.client, request) # Verify self.assertTrue(isinstance(loaded_user, oauth_models.OAuthUser)) self.assertEqual(loaded_user.id, user.key.id())