-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #362 from J-Priebe/creds-args
Make service account file & credentials optional arguments, clean up BaseAPI scope
- Loading branch information
Showing
5 changed files
with
75 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,15 +28,34 @@ Some simple guidelines to follow when contributing code: | |
Tests | ||
----- | ||
|
||
Before commiting your changes, please run the tests. For running the tests you need a service account. | ||
Before commiting your changes, please run the tests. For running the tests you need service account credentials in a JSON file. | ||
These do NOT have to be real credentials, but must have a properly encoded private key. You can create a key for testing using a site | ||
like `cryptotools <https://cryptotools.net/rsagen/>`_ . For example: | ||
|
||
**Please do not use a service account, which is used in production!** | ||
:: | ||
|
||
{ | ||
"type": "service_account", | ||
"project_id": "splendid-donkey-123", | ||
"private_key_id": "12345", | ||
"private_key": "-----BEGIN RSA PRIVATE KEY-----\nMYTESTKEY\n-----END RSA PRIVATE KEY-----", | ||
"client_email": "[email protected]", | ||
"client_id": "789", | ||
"auth_uri": "https://accounts.google.com/o/oauth2/auth", | ||
"token_uri": "https://oauth2.googleapis.com/token", | ||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", | ||
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-splendid-donkey-123.iam.gserviceaccount.com", | ||
"universe_domain": "googleapis.com" | ||
} | ||
|
||
**Please do not use a service account or private key, which is used in production!** | ||
|
||
:: | ||
|
||
pip install . ".[test]" | ||
|
||
export GOOGLE_APPLICATION_CREDENTIALS="service_account.json" | ||
export GOOGLE_APPLICATION_CREDENTIALS="path/to/service_account.json" | ||
export FCM_TEST_PROJECT_ID="test-project-id" | ||
|
||
python -m pytest | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,3 @@ rsa==4.9 | |
requests>=2.6.0 | ||
urllib3==1.26.19 | ||
pytest-mock==3.14.0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters