-
Notifications
You must be signed in to change notification settings - Fork 338
Updated Auth API #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
hiranya911
commented
Mar 27, 2017
- Change firebase module to firebase_admin
- Made 'credential' a positional argument of initialize_app()
- Updated affected test cases and linter scripts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments.
firebase_admin/__init__.py
Outdated
@@ -18,7 +20,8 @@ def initialize_app(options, name=_DEFAULT_APP_NAME): | |||
App constructor. | |||
|
|||
Args: | |||
options: A dictionary of configuration options. | |||
credential: A credential object derived from credentials.Base interface (optional). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we need the credentials.Base
stuff in there? Is there a way to indicate a type of the arg so that it gets picked up in our ref docs and here we can just put something like "A credential object used to initialize the SDK (optional). If none is provided, Google Application Default Credentials are used."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the docstring as suggested. Unfortunately there's no way to cross reference other types (at least not in Python itself). But there may be some doc plugins out there that support something like this.
firebase_admin/auth.py
Outdated
@@ -1,21 +1,18 @@ | |||
"""Firebase Authentication Library. | |||
"""Firebase custom authentication module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: "Firebase Authentication module". This won't just be for custom auth in the future once we add user management stuff and the capital "A" is because it references the product.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
tests/test_app.py
Outdated
'StringOptions': ('foo', ValueError), | ||
} | ||
|
||
invalid_credentials = [None, '', 'foo', 0, 1, dict(), list(), tuple(), True, False] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None
is a valid credential, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you're right. Removed it. It currently raises an exception for None, since we haven't implemented App default credential type yet.
tests/test_app.py
Outdated
@@ -1,72 +1,69 @@ | |||
"""Tests for firebase.App.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/firebase/firebase_admin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,77 @@ | |||
"""Firebase credentials module.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding tests for this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a couple of basic test cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. And CI passed, so you are good to go!