def test_successful_request_new_google_access_token(self): with self.app.test_request_context(): with HTTMock(self.mock_successful_request_new_google_access_token): google_api_functions.request_new_google_access_token('meowser_refresh_token', self.app.config['RUNNING_STATE_DIR'], self.app.config['GA_CLIENT_ID'], self.app.config['GA_CLIENT_SECRET']) with self.app.app_context(): ga_config = google_api_functions.read_ga_config(self.app.config['RUNNING_STATE_DIR']) self.assertEqual(ga_config['access_token'], 'meowser_access_token')
def test_failure_to_request_new_google_access_token(self): with self.app.test_request_context(): with HTTMock(self.mock_failed_request_new_google_access_token): with self.assertRaises(Exception): google_api_functions.request_new_google_access_token( "meowser_refresh_token", self.app.config["RUNNING_STATE_DIR"], self.app.config["GA_CLIENT_ID"], self.app.config["GA_CLIENT_SECRET"], )
def test_successful_request_new_google_access_token(self): with self.app.test_request_context(): with HTTMock(self.mock_successful_request_new_google_access_token): google_api_functions.request_new_google_access_token( "meowser_refresh_token", self.app.config["RUNNING_STATE_DIR"], self.app.config["GA_CLIENT_ID"], self.app.config["GA_CLIENT_SECRET"], ) with self.app.app_context(): ga_config = google_api_functions.read_ga_config(self.app.config["RUNNING_STATE_DIR"]) self.assertEqual(ga_config["access_token"], "meowser_access_token")