mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix regression tests with runtime auth. Fixes #2228
This commit is contained in:
parent
6696b3c316
commit
3317a02120
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user