Fix regression tests with runtime auth. Fixes #2228

This commit is contained in:
Dave Page 2017-03-06 15:24:52 +00:00
parent 6696b3c316
commit 3317a02120
2 changed files with 3 additions and 1 deletions

View File

@ -414,13 +414,14 @@ def create_app(app_name=config.APP_NAME):
@app.before_request
def before_request():
"""Login the default user if running in desktop mode"""
if app.PGADMIN_RUNTIME == True:
if not config.SERVER_MODE and app.PGADMIN_KEY != '':
if (
(not 'key' in request.args or request.args['key'] != app.PGADMIN_KEY) and
request.cookies.get('PGADMIN_KEY') != app.PGADMIN_KEY
):
abort(401)
if not config.SERVER_MODE:
user = user_datastore.get_user(config.DESKTOP_USER)
# Throw an error if we failed to find the desktop user, to give

View File

@ -91,6 +91,7 @@ config.CONSOLE_LOG_LEVEL = WARNING
# Create the app
app = create_app()
app.config['WTF_CSRF_ENABLED'] = False
app.PGADMIN_KEY = ''
test_client = app.test_client()
driver = webdriver.Chrome()
app_starter = AppStarter(driver, config)