This repository has been archived by the owner on Jul 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Do not do VAPID auth on trusted connections
Closes #938
- Loading branch information
Showing
4 changed files
with
36 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
from mock import patch, Mock | ||
from nose.tools import eq_ | ||
|
||
from autopush.tests.test_integration import _get_vapid | ||
|
||
|
||
class TestUserAgentParser(unittest.TestCase): | ||
def _makeFUT(self, *args): | ||
|
@@ -31,6 +33,12 @@ def test_other_os_and_browser(self): | |
eq_(dd["ua_browser_family"], "Other") | ||
eq_(raw["ua_browser_family"], "BlackBerry") | ||
|
||
def test_trusted_vapid(self): | ||
from autopush.utils import extract_jwt | ||
vapid_info = _get_vapid(payload={'sub': 'mailto:[email protected]'}) | ||
data = extract_jwt(vapid_info['auth'], 'invalid_key', is_trusted=True) | ||
eq_(data['sub'], 'mailto:[email protected]') | ||
|
||
@patch("requests.get") | ||
def test_get_ec2_instance_id_unknown(self, request_mock): | ||
import requests | ||
|
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