-
-
Notifications
You must be signed in to change notification settings - Fork 52
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 #149 from ahopkins/dev
Version 1.2.2 - 2019-03-14
- Loading branch information
Showing
11 changed files
with
99 additions
and
35 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,4 +1,4 @@ | ||
__version__ = "1.2.1" | ||
__version__ = "1.2.2" | ||
__author__ = "Adam Hopkins" | ||
__credits__ = "Richard Kuesters" | ||
|
||
|
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from sanic_jwt import Initialize | ||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def app_with_retrieve_user_on_bp( | ||
authenticate, retrieve_user, app_with_bp_setup_without_init | ||
): | ||
app, bp = app_with_bp_setup_without_init | ||
sanicjwt = Initialize( | ||
bp, | ||
app=app, | ||
authenticate=authenticate, | ||
retrieve_user=retrieve_user, | ||
debug=True, | ||
) | ||
app.blueprint(bp) | ||
return app, sanicjwt, bp | ||
|
||
|
||
def test_me(app_with_retrieve_user_on_bp): | ||
app, sanicjwt, bp = app_with_retrieve_user_on_bp | ||
_, response = app.test_client.post( | ||
sanicjwt._get_url_prefix() + "/", | ||
json={"username": "user1", "password": "abcxyz"}, | ||
) | ||
|
||
assert response.status == 200 | ||
|
||
access_token = response.json.get(sanicjwt.config.access_token_name(), None) | ||
|
||
_, response = app.test_client.get( | ||
sanicjwt._get_url_prefix() + "/me", | ||
headers={"Authorization": "Bearer {}".format(access_token)}, | ||
) | ||
|
||
assert response.status == 200 | ||
assert response.json.get("me").get("user_id") == 1 |
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