Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Filienko committed Aug 8, 2024
1 parent 0afb216 commit 25c467a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
3 changes: 1 addition & 2 deletions jwt_proxy/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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)


Expand Down
15 changes: 4 additions & 11 deletions tests/test_api.py
Original file line number Diff line number Diff line change
@@ -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')
Expand Down

0 comments on commit 25c467a

Please sign in to comment.