feat(auth): Recognize `FIREBASE_AUTH_EMULATOR_HOST` environment variable by maku693 · Pull Request #414 · firebase/firebase-admin-go

hiranya911 pushed a commit to firebase/firebase-admin-python that referenced this pull request

@muru

…HOST environment variable. (#531)

* Support auth emulator via FIREBASE_AUTH_EMULATOR_HOST

Modeled on firebase/firebase-admin-go#414

* Tests for emulator support in auth, user mgmt and token gen

To minimize modification of tests, the app fixture and instrumentation
have been modified to use a global dict of URLs, which are then
monkey-patched based on fixture parameters. Essentially, all tests using
the app fixture are run twice, once with the emulated endpoint and once
without.

* fallback for monkeypatch in python 3.5

* Token verification for the auth emulator

* Accommodate auth emulator behaviour in tests.

Where possible, tests are modified to account for the current behaviour
in emulator mode (e.g., invalid or expired tokens or cookies still
work).

Fixtures were changed to function scope to avoid problems caused by
overlap when some fixtures being in emulator mode and some in normal
mode concurrently.