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" PRE_COMMIT_COLOR: "always"
SPIFFWORKFLOW_BACKEND_DATABASE_PASSWORD: password SPIFFWORKFLOW_BACKEND_DATABASE_PASSWORD: password
SPIFFWORKFLOW_BACKEND_DATABASE_TYPE: ${{ matrix.database }} SPIFFWORKFLOW_BACKEND_DATABASE_TYPE: ${{ matrix.database }}
SPIFFWORKFLOW_BACKEND_RUNNING_IN_CI: 'true'
steps: steps:
- name: Check out the repository - name: Check out the repository

View File

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