def testLocalRunOnRemoteAPIShell(self): with mock.patch('google.appengine.tools.remote_api_shell' '.remote_api_stub') as _: with mock.patch('google.appengine.tools.remote_api_shell' '.code') as _: sys.argv = ['shell.py', '-s', 'app_id.appspot.com', 'app_id'] remote_api_shell.main(sys.argv) self.assertFalse(common.local_run())
def _get_storage_api(retry_params, account_id=None): """Returns storage_api instance for API methods. Args: retry_params: An instance of api_utils.RetryParams. If none, thread's default will be used. account_id: Internal-use only. Returns: A storage_api instance to handle urlfetch work to GCS. On dev appserver, this instance by default will talk to a local stub unless common.ACCESS_TOKEN is set. That token will be used to talk to the real GCS. """ api = _StorageApi(_StorageApi.full_control_scope, service_account_id=account_id, retry_params=retry_params) if common.local_run() and not common.get_access_token(): api.api_url = common.local_api_url() if common.get_access_token(): api.token = common.get_access_token() return api
def is_local(): return local_run()
def base_url(): if local_run(): return local_api_url() return "https://storage.googleapis.com"
def testLocalRunOnRemoteAPIShell(self): with mock.patch("google.appengine.tools.remote_api_shell" ".remote_api_stub") as _: with mock.patch("google.appengine.tools.remote_api_shell" ".code") as _: sys.argv = ["shell.py", "-s", "app_id.appspot.com", "app_id"] remote_api_shell.main(sys.argv) self.assertFalse(common.local_run())