Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
Merge cae0896 into c270841
Browse files Browse the repository at this point in the history
  • Loading branch information
chyok committed Nov 6, 2019
2 parents c270841 + cae0896 commit d928c25
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ sudo: false
language: python
python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
- "pypy"

install:
Expand Down
3 changes: 3 additions & 0 deletions flask_jwt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ def init_app(self, app):

auth_url_options = app.config.get('JWT_AUTH_URL_OPTIONS', {'methods': ['POST']})
auth_url_options.setdefault('view_func', self.auth_request_callback)
auth_endpoint = app.config.get('JWT_AUTH_ENDPOINT', None)
if auth_endpoint:
auth_url_options.setdefault('endpoint', auth_endpoint)
app.add_url_rule(auth_url_rule, **auth_url_options)

app.errorhandler(JWTError)(self._jwt_error_callback)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[pytest]
[tool:pytest]
pep8maxlinelength = 99
pep8ignore =
docs/* ALL
Expand Down
Empty file added tests/__init__.py
Empty file.
5 changes: 4 additions & 1 deletion tests/test_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import jwt as _jwt
import pytest

from flask import Flask, json, jsonify
from flask import Flask, json, jsonify, url_for

import flask_jwt

Expand Down Expand Up @@ -44,9 +44,12 @@ def test_adds_auth_endpoint():
app.config['SECRET_KEY'] = 'super-secret'
app.config['JWT_AUTH_URL_RULE'] = '/auth'
app.config['JWT_AUTH_ENDPOINT'] = 'jwt_auth'
app.config['SERVER_NAME'] = 'localhost'
flask_jwt.JWT(app, lambda: None, lambda: None)
rules = [str(r) for r in app.url_map._rules]
assert '/auth' in rules
with app.app_context():
assert url_for('jwt_auth') == 'http://localhost/auth'


def test_auth_endpoint_with_valid_request(client, user):
Expand Down

0 comments on commit d928c25

Please sign in to comment.