-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: datetime.utcnow() is deprecated and scheduled for removal
- Loading branch information
Showing
3 changed files
with
10 additions
and
10 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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import json | ||
from datetime import datetime, timedelta | ||
import time | ||
from importlib import import_module | ||
from unittest.mock import Mock, patch | ||
|
||
|
@@ -57,7 +57,7 @@ def get_expected_to_str(self): | |
return "[email protected]" | ||
|
||
def get_google_id_token_payload(self): | ||
now = datetime.utcnow() | ||
now = int(time.time()) | ||
client_id = "app123id" # Matches `setup_app` | ||
payload = { | ||
"iss": "https://accounts.google.com", | ||
|
@@ -74,7 +74,7 @@ def get_google_id_token_payload(self): | |
"family_name": "Penners", | ||
"locale": "en", | ||
"iat": now, | ||
"exp": now + timedelta(hours=1), | ||
"exp": now + 60 * 60, | ||
} | ||
payload.update(self.identity_overwrites) | ||
return payload | ||
|
@@ -97,7 +97,7 @@ def test_login(self): | |
def test_wrong_id_token_claim_values(self): | ||
wrong_claim_values = { | ||
"iss": "not-google", | ||
"exp": datetime.utcnow() - timedelta(seconds=1), | ||
"exp": time.time() - 1, | ||
"aud": "foo", | ||
} | ||
for key, value in wrong_claim_values.items(): | ||
|