only test admin permissions in ci since it takes longer run w/ burnettk

This commit is contained in:
jasquat 2023-05-24 11:10:40 -04:00
parent 5bdcb0f6e5
commit 692e584dac
No known key found for this signature in database
2 changed files with 11 additions and 7 deletions

View File

@ -84,6 +84,7 @@ jobs:
PRE_COMMIT_COLOR: "always"
SPIFFWORKFLOW_BACKEND_DATABASE_PASSWORD: password
SPIFFWORKFLOW_BACKEND_DATABASE_TYPE: ${{ matrix.database }}
SPIFFWORKFLOW_BACKEND_RUNNING_IN_CI: 'true'
steps:
- name: Check out the repository

View File

@ -1,4 +1,4 @@
"""Conftest."""
# noqa
import os
import shutil
@ -25,8 +25,7 @@ from spiffworkflow_backend import create_app # noqa: E402
@pytest.fixture(scope="session")
def app() -> Flask:
"""App."""
def app() -> Flask: # noqa
os.environ["SPIFFWORKFLOW_BACKEND_ENV"] = "unit_testing"
os.environ["FLASK_SESSION_SECRET_KEY"] = "e7711a3ba96c46c68e084a86952de16f"
app = create_app()
@ -53,8 +52,12 @@ def with_db_and_bpmn_file_cleanup() -> None:
@pytest.fixture()
def with_super_admin_user() -> UserModel:
"""With_super_admin_user."""
user = BaseTest.find_or_create_user(username="testadmin1")
AuthorizationService.import_permissions_from_yaml_file(user)
def with_super_admin_user() -> UserModel: # noqa
# this loads all permissions from yaml everytime this function is called which is slow
# so default to just setting a simple super admin and only run with the "real" permissions in ci
if os.environ.get("SPIFFWORKFLOW_BACKEND_RUNNING_IN_CI") == "true":
user = BaseTest.find_or_create_user(username="testadmin1")
AuthorizationService.import_permissions_from_yaml_file(user)
else:
user = BaseTest.create_user_with_permission("super_admin")
return user