Open
Show file tree
Hide file tree
Changes from all commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Failed to load files.
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,7 @@ jobs:
run: |
npm install -g firebase-tools
firebase emulators:exec --only database --project fake-project-id 'pytest integration/test_db.py'
firebase emulators:exec --only storage --project fake-project-id 'pytest integration/test_storage.py --cert tests/data/service_account.json'

lint:
runs-on: ubuntu-latest
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -218,6 +218,7 @@ First, install the Firebase CLI, then run:

```
firebase emulators:exec --only database --project fake-project-id 'pytest integration/test_db.py'
firebase emulators:exec --only storage --project fake-project-id 'pytest integration/test_storage.py --cert tests/data/service_account.json'
```

### Test Coverage
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,12 +21,14 @@
# pylint: disable=import-error,no-name-in-module
try:
from google.cloud import storage
from google.cloud.storage._helpers import STORAGE_EMULATOR_ENV_VAR
except ImportError:
raise ImportError('Failed to import the Cloud Storage library for Python. Make sure '
'to install the "google-cloud-storage" module.')

from firebase_admin import _utils
import os

from firebase_admin import _utils

_STORAGE_ATTRIBUTE = '_storage'

Expand DownExpand Up@@ -61,7 +63,10 @@ def __init__(self, credentials, project, default_bucket):

@classmethod
def from_app(cls, app):
credentials = app.credential.get_credential()
if os.getenv(STORAGE_EMULATOR_ENV_VAR) is not None:
credentials = _utils.EmulatorAdminCredentials()
else:
credentials = app.credential.get_credential()
default_bucket = app.options.get('storageBucket')
# Specifying project ID is not required, but providing it when available
# significantly speeds up the initialization of the storage client.
Expand Down