Skip to content

Commit 63dc210

Browse files
committed
Update Firebase test project setup instructions.
1 parent e2ddedb commit 63dc210

File tree

1 file changed

+79
-38
lines changed

1 file changed

+79
-38
lines changed

CONTRIBUTING.md

Lines changed: 79 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -162,44 +162,85 @@ pytest --cov=firebase_admin --cov=tests
162162

163163
### Integration Testing
164164

165-
A suite of integration tests are available under the `integration/` directory.
166-
These tests are designed to run against an actual Firebase project. Create a new
167-
project in the [Firebase Console](https://console.firebase.google.com), if you
168-
do not already have one suitable for running the tests aginst. Then obtain the
169-
following credentials from the project:
170-
171-
1. *Service account certificate*: This can be downloaded as a JSON file from
172-
the "Settings > Service Accounts" tab of the Firebase console. Copy the
173-
file into the repo so it's available at `cert.json`.
174-
2. *Web API key*: This is displayed in the "Settings > General" tab of the
175-
console. Copy it and save to a new text file at `apikey.txt`.
176-
177-
Then set up your Firebase/GCP project as follows:
178-
179-
1. Enable Firestore: Go to the Firebase Console, and select "Database" from
180-
the "Develop" menu. Click on the "Create database" button. You may choose
181-
to set up Firestore either in the locked mode or in the test mode.
182-
2. Enable password auth: Select "Authentication" from the "Develop" menu in
183-
Firebase Console. Select the "Sign-in method" tab, and enable the
184-
"Email/Password" sign-in method, including the Email link (passwordless
185-
sign-in) option.
186-
3. Enable the Firebase ML API: Go to the
187-
[Google Developers Console](
188-
https://console.developers.google.com/apis/api/firebaseml.googleapis.com/overview)
189-
and make sure your project is selected. If the API is not already enabled, click Enable.
190-
4. Enable the IAM API: Go to the
191-
[Google Cloud Platform Console](https://console.cloud.google.com) and make
192-
sure your Firebase/GCP project is selected. Select "APIs & Services >
193-
Dashboard" from the main menu, and click the "ENABLE APIS AND SERVICES"
194-
button. Search for and enable the "Identity and Access Management (IAM)
195-
API".
196-
5. Grant your service account the 'Firebase Authentication Admin' role. This is
197-
required to ensure that exported user records contain the password hashes of
198-
the user accounts:
199-
1. Go to [Google Cloud Platform Console / IAM & admin](https://console.cloud.google.com/iam-admin).
200-
2. Find your service account in the list, and click the 'pencil' icon to edit it's permissions.
201-
3. Click 'ADD ANOTHER ROLE' and choose 'Firebase Authentication Admin'.
202-
4. Click 'SAVE'.
165+
166+
A suite of integration tests are available under the `integration/` directory. These tests
167+
are designed to run against an actual Firebase project. If you do not already have one
168+
suitable for running the tests against, you can create a new project in the
169+
[Firebase Console](https://console.firebase.google.com) following the setup guide below.
170+
Otherwise you can obtain the following credentials from your current project:
171+
172+
173+
1. Service account certificate: This can be downloaded as a JSON file from the
174+
**'Settings > Service Accounts'** tab of the Firebase console. Copy the file into the repo
175+
so it's available at `cert.json`.
176+
177+
178+
2. Web API key: This is displayed in the **'Settings > General'** tab of the Firebase console
179+
after enabling Authentication as described in the steps below. Copy it and save to a new text
180+
file at `apikey.txt`.
181+
182+
183+
Set up your Firebase project as follows:
184+
185+
186+
1. Enable Authentication:
187+
1. Go to the Firebase Console, and select **'Authentication'** from the **'Build'** menu.
188+
2. Click on **'Get Started'**.
189+
3. Select **'Sign-in method > Add new provider > Email/Password'** then enable both the
190+
**'Email/Password'** and **'Email link (passwordless sign-in)'** options.
191+
192+
193+
2. Enable Firestore:
194+
1. Go to the Firebase Console, and select **'Firestore Database'** from the **'Build'** menu.
195+
2. Click on the **'Create database'** button. You can choose to set up Firestore either in
196+
the production mode or in the test mode.
197+
198+
199+
3. Enable Realtime Database:
200+
1. Go to the Firebase Console, and select **'Realtime Database'** from the **'Build'** menu.
201+
2. Click on the **'Create database'** button. You can choose to set up the Realtime database
202+
either in the locked mode or in the test mode.
203+
3. In the **'Data'** tab click on the kebab menu (3 dots) and select **'Create Database'**.
204+
4. Enter your Project ID (Found in the **'General'** tab in **'Account Settings'**) as the
205+
**'Realtime Database reference'**. Again, you can choose to set up the Realtime database
206+
either in the locked mode or in the test mode.
207+
208+
209+
4. Enable Storage:
210+
1. Go to the Firebase Console, and select **'Storage'** from the **'Build'** menu.
211+
2. Click on the **'Get started'** button. You can choose to set up the Realtime database
212+
either in the production mode or in the test mode.
213+
214+
215+
5. Enable the Firebase ML API:
216+
1. Go to the [Google Developers Console | Firebase ML API](
217+
https://console.developers.google.com/apis/api/firebaseml.googleapis.com/overview) and make
218+
sure your project is selected.
219+
2. If the API is not already enabled, click **'Enable'**.
220+
221+
222+
6. Enable the IAM API:
223+
1. Go to the [Google Cloud Platform Console](https://console.cloud.google.com) and make sure
224+
your Firebase project is selected.
225+
2. Select **'APIs & Services'** from the main menu, and click the
226+
**'ENABLE APIS AND SERVICES'** button.
227+
3. Search for and enable **'Identity and Access Management (IAM) API'** by Google Enterprise API.
228+
229+
230+
7. Enable Tenant Management:
231+
1. Go to
232+
[Google Developers Console | Identity Platform](https://console.cloud.google.com/customer-identity/)
233+
and if it is not already enabled, click **'Enable'**.
234+
2. Then follow [this guide](https://cloud.google.com/identity-platform/docs/multi-tenancy-quickstart#enabling_multi-tenancy) to enable multi-tenancy.
235+
236+
237+
8. Ensure your service account has the **'Firebase Authentication Admin'** role. This is required
238+
to ensure that exported user records contain the password hashes of the user accounts:
239+
1. Go to [Google Cloud Platform Console / IAM & admin](https://console.cloud.google.com/iam-admin).
240+
2. Find your service account in the list. If not added click the **'pencil'** icon to edit its
241+
permissions.
242+
3. Click **'ADD ANOTHER ROLE'** and choose **'Firebase Authentication Admin'**.
243+
4. Click **'SAVE'**.
203244

204245

205246
Now you can invoke the integration test suite as follows:

0 commit comments

Comments
 (0)