GoogleCloudPlatform / appengine-gcs-client

App Engine-Cloud Storage custom client library
Apache License 2.0
124 stars 112 forks source link

_get_storage_api: Fix local App Engine unit tests #51

Closed evanj closed 7 years ago

evanj commented 7 years ago

Commit 19f0768 added support for running dev_appserver.py with real credentials. However, it broke running App Engine unit tests. When testing, app_identity.get_service_account_name() returns 'test@localhost', which no longer is changed to the local stub URL. To fix this, we consider both an empty service account, as well as any '@localhost' service account as a test that should use local stubs.

The cloudstorage_test.py tests now pass, and the demo still works with service account credentials passed using --appidentity_private_key_path