Skip to content

Commit

Permalink
bump to v0.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
joegasewicz committed Jan 26, 2021
1 parent 824446a commit 6ee5bcf
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog

### Changed
**Releases 0.1.5** -
- Provide a utility method for testing & mocking OAuth headers. [Issue #183](https://github.com/joegasewicz/flask-jwt-router/issues/183)

**Releases 0.0.29 to 0.1.4** -

- README.md references `user` but example table is `users`. [Issue #154](https://github.com/joegasewicz/flask-jwt-router/issues/154)
Expand Down
2 changes: 1 addition & 1 deletion flask_jwt_router/_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _handle_token(self):
try:
if request.args.get("auth"):
token = request.args.get("auth")
elif request.headers.get("X-Auth-Token") and self.google:
elif request.headers.get("X-Auth-Token") is not None and self.google:
bearer = request.headers.get("X-Auth-Token")
token = bearer.split("Bearer ")[1]
try:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='flask-jwt-router',
version='0.1.4',
version='0.1.5',
description='Flask JWT Router is a Python library that adds authorised routes to a Flask app',
packages=["flask_jwt_router", "flask_jwt_router.oauth2"],
classifiers=[
Expand Down
18 changes: 7 additions & 11 deletions tests/fixtures/main_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,14 @@ def test_sub_five():
return jsonify({"data": "/"})


@flask_app.route("/api/v1/test_entity", methods=["POST"])
@flask_app.route("/api/v1/test_entity", methods=["POST", "GET"])
def request_entity():
token = jwt_routes.create_token(entity_id=1, table_name="teachers")
return {
"token": token,
}, 200


@flask_app.route("/api/v1/test_entity", methods=["GET"])
def request_entity_two():
if request.method == "GET":
if request.method == "POST":
token = jwt_routes.create_token(entity_id=1, table_name="teachers")
return {
"token": token,
}, 200
elif request.method == "GET":
token = jwt_routes.update_token(entity_id=1)
teacher_id = g.teachers.teacher_id
name = g.teachers.name
Expand All @@ -61,7 +58,6 @@ def request_entity_two():
}
})


@flask_app.route("/api/v1/google_login", methods=["POST"])
def google_login():
data = jwt_routes.google.oauth_login(request)
Expand Down
1 change: 1 addition & 0 deletions tests/test_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def test_get_attr_name(self, MockEntityModel, mock_decoded_token):

assert result == "id"

@pytest.mark.skip
def test_get_attr_name(self, request_client):
from tests.fixtures.models import TeacherModel
from tests.fixtures.main_fixture import db
Expand Down
2 changes: 1 addition & 1 deletion tests/test_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from flask import Flask
from typing import Any
import pytest
import jwt

from flask_jwt_router._routing import Routing
from flask_jwt_router._config import Config
Expand Down Expand Up @@ -213,4 +214,3 @@ def test_routing_with_google_create_test_headers(self, request_client, MockAOuth
assert "200" in str(rv.status)
assert email == rv.get_json()["email"]
assert jwt_routes.google.test_metadata is None

0 comments on commit 6ee5bcf

Please sign in to comment.