def testGetApi_CachedCredentials(self):
    my_mocks = self._MockGoogleClientApi()

    api = self.gce_api.GetApi()

    self.assertEqual(my_mocks['api'], api)
    self.assertEqual(1, my_mocks['storage_class'].call_count)
    # When cached credentials are valid, OAuth2 dance won't happen.
    self.assertFalse(my_mocks['flow_class'].called)
    self.assertFalse(oauth2client.tools.run.called)
    self.assertEqual(1, my_mocks['local_credentials'].authorize.call_count)
    apiclient.discovery.build.assert_called_once_with(
        'compute', mock.ANY,
        http=my_mocks['http_authorized_by_local_credentials'])
    self.assertRegexpMatches(
        apiclient.discovery.build.call_args[0][1], '^v\\d')
An observer which updates the proxy when the ToolButton changes.
dataset/ETHPy150Open GoogleCloudPlatform/Solutions-Using-ETL-tool-on-Google-Compute-Engine/gce_api_test.py/GceApiTest.testGetApi_CachedCredentials--crossover with--dataset/ETHPy150Open nucleic/enaml/enaml/widgets/tool_button.py/ToolButton._update_proxy