added test for backing up user datastore

This commit is contained in:
Simon Pirkelmann 2022-01-31 22:59:44 +01:00
parent f945b7f79e
commit 95f0ff3563
2 changed files with 15 additions and 0 deletions

View File

@ -1,8 +1,11 @@
import pytest
import os
from selenium.webdriver import Chrome
from imaginaerraum_door_admin import create_app
os.environ['APPLICATION_SETTINGS'] = os.getcwd() + '/debug_app_config.py'
@pytest.fixture(scope='session')
def app():

View File

@ -154,6 +154,18 @@ def temp_admin(client_authenticated):
'password': password}
def test_backup_users(client_authenticated, temp_user):
# test with invalid token
response = client_authenticated.get("/backup_user_datastore",
follow_redirects=True)
user_data = json.loads(response.data)
users = [d['username'] for d in user_data]
emails = [d['email'] for d in user_data]
assert temp_user['username'] in users
assert temp_user['email'] in emails
def test_create_admin(client_authenticated):
password = create_user(client_authenticated, 'bilbo', 'bilbo@shire.me')