8000 Handling non-existing validSince case on UserRecord by hiranya911 · Pull Request #220 · firebase/firebase-admin-python · GitHub
[go: up one dir, main page]

Skip to content

Handling non-existing validSince c 8000 ase on UserRecord #220

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

Merged
merged 3 commits into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- [fixed] Fixing error handling in FCM. The SDK now checks the key
type.googleapis.com/google.firebase.fcm.v1.FcmError to set error code.
- [fixed] Ensuring that `UserRecord.tokens_valid_after_time` always
returns an integer, and never returns `None`.

# v2.13.0

Expand Down
2 changes: 1 addition & 1 deletion firebase_admin/_user_mgt.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def tokens_valid_after_timestamp(self):
valid_since = self._data.get('validSince')
if valid_since is not None:
return 1000 * int(valid_since)
return None
return 0

@property
def user_metadata(self):
Expand Down
8 changes: 8 additions & 0 deletions tests/test_user_mgt.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ def test_invalid_provider(self, data):
with pytest.raises(ValueError):
_user_mgt.ProviderUserInfo(data)

def test_tokens_valid_after_time(self):
user = auth.UserRecord({'localId' : 'user', 'validSince' : 100})
assert user.tokens_valid_after_timestamp == 100000

def test_no_tokens_valid_after_time(self):
user = auth.UserRecord({'localId' : 'user'})
assert user.tokens_valid_after_timestamp is 0


class TestGetUser(object):

Expand Down
0