diff --git a/tests/conftest.py b/tests/conftest.py index 411fa2c..5ba7c39 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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(): diff --git a/tests/test_webinterface.py b/tests/test_webinterface.py index f0c31d2..97af12e 100644 --- a/tests/test_webinterface.py +++ b/tests/test_webinterface.py @@ -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')