diff --git a/jwt_proxy/app.py b/jwt_proxy/app.py index 64b2f02..181851b 100644 --- a/jwt_proxy/app.py +++ b/jwt_proxy/app.py @@ -9,9 +9,9 @@ def create_app(testing=False, cli=False): """Application factory, used to create application""" app = Flask("jwt_proxy") + app.json = CustomJSONProvider(app) register_blueprints(app) configure_app(app) - print("Configuring") return app @@ -23,7 +23,6 @@ def register_blueprints(app): def configure_app(app): """Load successive configs - overriding defaults""" app.config.from_object("jwt_proxy.config") - app.json = CustomJSONProvider(app) configure_logging(app) diff --git a/tests/test_api.py b/tests/test_api.py index 203b5e1..9741076 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1,22 +1,15 @@ import unittest -from flask import Flask -from jwt_proxy.api import blueprint, proxy_request, validate_jwt, smart_configuration, config_settings -import json from unittest.mock import patch, MagicMock +import json import jwt +from jwt_proxy.api import proxy_request +from jwt_proxy.app import create_app class TestAuthBlueprint(unittest.TestCase): def setUp(self): """Set up a test Flask app and client""" - self.app = Flask(__name__) + self.app = create_app() self.app.config['TESTING'] = True - self.app.config['UPSTREAM_SERVER'] = 'http://example.com' - self.app.config['JWKS_URL'] = 'http://jwks.example.com' - self.app.config['PATH_WHITELIST'] = ['/whitelisted'] - self.app.config['OIDC_AUTHORIZE_URL'] = 'http://authorize.example.com' - self.app.config['OIDC_TOKEN_URI'] = 'http://token.example.com' - self.app.config['OIDC_TOKEN_INTROSPECTION_URI'] = 'http://introspection.example.com' - self.app.register_blueprint(blueprint) self.client = self.app.test_client() @patch('requests.request')