only check api keys on selected resources
This commit is contained in:
@@ -6,3 +6,4 @@ ESALES_URL = ''
|
||||
TESTING = True
|
||||
DEBUG = True
|
||||
SQLALCHEMY_ECHO = False
|
||||
API_KEYS = None # api keys are disabled in test
|
||||
+9
-1
@@ -5,6 +5,7 @@ import json
|
||||
import base64
|
||||
from api import create_app
|
||||
from flask import Flask
|
||||
from api.helpers import check_api_key
|
||||
from api.validators import ValidationError, validate_exists, validate_number, validate_territory, validate_jsonschema
|
||||
|
||||
|
||||
@@ -13,7 +14,14 @@ class TestHttpBasicAuth(flask_testing.TestCase):
|
||||
api_key = 'secret'
|
||||
|
||||
def create_app(self):
|
||||
return create_app('tests.config')
|
||||
app = Flask(__name__)
|
||||
app.before_request(check_api_key)
|
||||
|
||||
@app.route('/', methods=['GET'])
|
||||
def index():
|
||||
return 'ok'
|
||||
|
||||
return app
|
||||
|
||||
def _enable_basic_auth(self):
|
||||
self.app.config['API_KEYS'] = [self.api_key]
|
||||
|
||||
Reference in New Issue
Block a user