This commit is contained in:
burnettk 2022-11-11 11:39:15 -05:00
parent 46a590749d
commit 2cb3fb27e2
81 changed files with 223 additions and 111 deletions

View File

@ -2,6 +2,7 @@
import csv
from flask_bpmn.models.db import db
from spiffworkflow_backend import get_hacked_up_app_for_script
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
from spiffworkflow_backend.models.user import UserModel

View File

@ -2,6 +2,7 @@
import time
from apscheduler.schedulers.background import BlockingScheduler # type: ignore
from spiffworkflow_backend import create_app
from spiffworkflow_backend import start_scheduler
from spiffworkflow_backend.helpers.db_helper import try_to_connect

View File

@ -7,6 +7,8 @@ from flask.app import Flask
from flask.testing import FlaskClient
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.models.active_task_user import ActiveTaskUserModel
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
from spiffworkflow_backend.models.user import UserModel
@ -17,7 +19,6 @@ from spiffworkflow_backend.services.process_instance_service import (
ProcessInstanceService,
)
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
# from tests.spiffworkflow_backend.helpers.test_data import load_test_spec

View File

@ -5,7 +5,6 @@ from typing import Any
import connexion # type: ignore
import flask.app
import flask.json
import spiffworkflow_backend.load_database_models # noqa: F401
import sqlalchemy
from apscheduler.schedulers.background import BackgroundScheduler # type: ignore
from apscheduler.schedulers.base import BaseScheduler # type: ignore
@ -15,6 +14,9 @@ from flask_bpmn.models.db import db
from flask_bpmn.models.db import migrate
from flask_cors import CORS # type: ignore
from flask_mail import Mail # type: ignore
from werkzeug.exceptions import NotFound
import spiffworkflow_backend.load_database_models # noqa: F401
from spiffworkflow_backend.config import setup_config
from spiffworkflow_backend.routes.admin_blueprint.admin_blueprint import admin_blueprint
from spiffworkflow_backend.routes.process_api_blueprint import process_api_blueprint
@ -24,7 +26,6 @@ from spiffworkflow_backend.services.authorization_service import AuthorizationSe
from spiffworkflow_backend.services.background_processing_service import (
BackgroundProcessingService,
)
from werkzeug.exceptions import NotFound
class MyJSONEncoder(DefaultJSONProvider):

View File

@ -3,9 +3,10 @@ import os
import threading
from flask.app import Flask
from spiffworkflow_backend.services.logging_service import setup_logger
from werkzeug.utils import ImportStringError
from spiffworkflow_backend.services.logging_service import setup_logger
class ConfigurationError(Exception):
"""ConfigurationError."""

View File

@ -6,13 +6,14 @@ from typing import TYPE_CHECKING
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.orm import RelationshipProperty
from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
from spiffworkflow_backend.models.task import Task
from spiffworkflow_backend.models.user import UserModel
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.orm import RelationshipProperty
if TYPE_CHECKING:

View File

@ -5,9 +5,10 @@ from dataclasses import dataclass
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from sqlalchemy import ForeignKey
from spiffworkflow_backend.models.active_task import ActiveTaskModel
from spiffworkflow_backend.models.user import UserModel
from sqlalchemy import ForeignKey
@dataclass

View File

@ -7,6 +7,7 @@ from typing import Optional
import marshmallow
from marshmallow import INCLUDE
from marshmallow import Schema
from spiffworkflow_backend.helpers.spiff_enum import SpiffEnum

View File

@ -4,12 +4,13 @@ from typing import TYPE_CHECKING
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from spiffworkflow_backend.models.message_correlation_property import (
MessageCorrelationPropertyModel,
)
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
if TYPE_CHECKING:
from spiffworkflow_backend.models.message_correlation_message_instance import ( # noqa: F401

View File

@ -3,9 +3,10 @@ from dataclasses import dataclass
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from sqlalchemy import ForeignKey
from spiffworkflow_backend.models.message_correlation import MessageCorrelationModel
from spiffworkflow_backend.models.message_instance import MessageInstanceModel
from sqlalchemy import ForeignKey
@dataclass

View File

@ -1,9 +1,10 @@
"""Message_correlation_property."""
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from spiffworkflow_backend.models.message_model import MessageModel
from sqlalchemy import ForeignKey
from spiffworkflow_backend.models.message_model import MessageModel
class MessageCorrelationPropertyModel(SpiffworkflowBaseDBModel):
"""MessageCorrelationPropertyModel."""

View File

@ -7,14 +7,15 @@ from typing import TYPE_CHECKING
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from spiffworkflow_backend.models.message_model import MessageModel
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
from sqlalchemy import ForeignKey
from sqlalchemy.event import listens_for
from sqlalchemy.orm import relationship
from sqlalchemy.orm import Session
from sqlalchemy.orm import validates
from spiffworkflow_backend.models.message_model import MessageModel
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
if TYPE_CHECKING:
from spiffworkflow_backend.models.message_correlation_message_instance import ( # noqa: F401
MessageCorrelationMessageInstanceModel,

View File

@ -1,9 +1,10 @@
"""Message_correlation_property."""
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from spiffworkflow_backend.models.message_model import MessageModel
from sqlalchemy import ForeignKey
from spiffworkflow_backend.models.message_model import MessageModel
class MessageTriggerableProcessModel(SpiffworkflowBaseDBModel):
"""MessageTriggerableProcessModel."""

View File

@ -4,11 +4,12 @@ from typing import Any
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from spiffworkflow_backend.models.permission_target import PermissionTargetModel
from spiffworkflow_backend.models.principal import PrincipalModel
from sqlalchemy import ForeignKey
from sqlalchemy.orm import validates
from spiffworkflow_backend.models.permission_target import PermissionTargetModel
from spiffworkflow_backend.models.principal import PrincipalModel
class PermitDeny(enum.Enum):
"""PermitDeny."""

View File

@ -3,12 +3,13 @@ from dataclasses import dataclass
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.models.user import UserModel
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.schema import CheckConstraint
from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.models.user import UserModel
class DataValidityError(Exception):
"""DataValidityError."""

View File

@ -9,6 +9,7 @@ from typing import Any
import marshmallow
from marshmallow import post_load
from marshmallow import Schema
from spiffworkflow_backend.models.process_model import ProcessModelInfo
@ -26,9 +27,7 @@ class ProcessGroup:
process_models: list[ProcessModelInfo] = field(
default_factory=list[ProcessModelInfo]
)
process_groups: list[ProcessGroup] = field(
default_factory=list['ProcessGroup']
)
process_groups: list[ProcessGroup] = field(default_factory=list["ProcessGroup"])
def __post_init__(self) -> None:
"""__post_init__."""

View File

@ -12,15 +12,16 @@ from marshmallow import INCLUDE
from marshmallow import Schema
from marshmallow_enum import EnumField # type: ignore
from SpiffWorkflow.util.deep_merge import DeepMerge # type: ignore
from sqlalchemy import ForeignKey
from sqlalchemy.orm import deferred
from sqlalchemy.orm import relationship
from sqlalchemy.orm import validates
from spiffworkflow_backend.helpers.spiff_enum import SpiffEnum
from spiffworkflow_backend.models.process_model import ProcessModelInfo
from spiffworkflow_backend.models.task import Task
from spiffworkflow_backend.models.task import TaskSchema
from spiffworkflow_backend.models.user import UserModel
from sqlalchemy import ForeignKey
from sqlalchemy.orm import deferred
from sqlalchemy.orm import relationship
from sqlalchemy.orm import validates
class NavigationItemSchema(Schema):

View File

@ -9,6 +9,10 @@ from typing import TypedDict
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from sqlalchemy import ForeignKey
from sqlalchemy.orm import deferred
from sqlalchemy.orm import relationship
from spiffworkflow_backend.exceptions.process_entity_not_found_error import (
ProcessEntityNotFoundError,
)
@ -17,9 +21,6 @@ from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.process_instance_processor import (
ProcessInstanceProcessor,
)
from sqlalchemy import ForeignKey
from sqlalchemy.orm import deferred
from sqlalchemy.orm import relationship
ReportMetadata = dict[str, Any]

View File

@ -9,6 +9,7 @@ from typing import Any
import marshmallow
from marshmallow import Schema
from marshmallow.decorators import post_load
from spiffworkflow_backend.models.file import File

View File

@ -4,9 +4,10 @@ from dataclasses import dataclass
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from marshmallow import Schema
from spiffworkflow_backend.models.user import UserModel
from sqlalchemy import ForeignKey
from spiffworkflow_backend.models.user import UserModel
@dataclass()
class SecretModel(SpiffworkflowBaseDBModel):

View File

@ -10,12 +10,13 @@ from flask_bpmn.api.api_error import ApiError
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from marshmallow import Schema
from sqlalchemy.orm import relationship
from sqlalchemy.orm import validates
from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.services.authentication_service import (
AuthenticationProviderTypes,
)
from sqlalchemy.orm import relationship
from sqlalchemy.orm import validates
class UserNotFoundError(Exception):

View File

@ -1,11 +1,12 @@
"""UserGroupAssignment."""
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.models.user import UserModel
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.models.user import UserModel
class UserGroupAssignmentModel(SpiffworkflowBaseDBModel):
"""UserGroupAssignmentModel."""

View File

@ -7,6 +7,8 @@ from flask import redirect
from flask import render_template
from flask import request
from flask import url_for
from werkzeug.wrappers import Response
from spiffworkflow_backend.services.process_instance_processor import (
ProcessInstanceProcessor,
)
@ -16,7 +18,6 @@ from spiffworkflow_backend.services.process_instance_service import (
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from spiffworkflow_backend.services.spec_file_service import SpecFileService
from spiffworkflow_backend.services.user_service import UserService
from werkzeug.wrappers import Response
admin_blueprint = Blueprint(
"admin", __name__, template_folder="templates", static_folder="static"

View File

@ -28,6 +28,9 @@ from lxml import etree # type: ignore
from lxml.builder import ElementMaker # type: ignore
from SpiffWorkflow.task import Task as SpiffTask # type: ignore
from SpiffWorkflow.task import TaskState
from sqlalchemy import asc
from sqlalchemy import desc
from spiffworkflow_backend.exceptions.process_entity_not_found_error import (
ProcessEntityNotFoundError,
)
@ -75,8 +78,6 @@ from spiffworkflow_backend.services.secret_service import SecretService
from spiffworkflow_backend.services.service_task_service import ServiceTaskService
from spiffworkflow_backend.services.spec_file_service import SpecFileService
from spiffworkflow_backend.services.user_service import UserService
from sqlalchemy import asc
from sqlalchemy import desc
class TaskDataSelectOption(TypedDict):
@ -178,10 +179,14 @@ def process_group_update(
return make_response(jsonify(process_group), 200)
def process_groups_list(process_group_identifier: Optional[str] = None, page: int = 1, per_page: int = 100) -> flask.wrappers.Response:
def process_groups_list(
process_group_identifier: Optional[str] = None, page: int = 1, per_page: int = 100
) -> flask.wrappers.Response:
"""Process_groups_list."""
if process_group_identifier is not None:
process_groups = ProcessModelService().get_process_groups(process_group_identifier)
process_groups = ProcessModelService().get_process_groups(
process_group_identifier
)
else:
process_groups = ProcessModelService().get_process_groups()
batch = ProcessModelService().get_batch(

View File

@ -12,13 +12,14 @@ from flask import g
from flask import redirect
from flask import request
from flask_bpmn.api.api_error import ApiError
from werkzeug.wrappers import Response
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.authentication_service import (
AuthenticationService,
)
from spiffworkflow_backend.services.authorization_service import AuthorizationService
from spiffworkflow_backend.services.user_service import UserService
from werkzeug.wrappers import Response
"""
.. module:: crc.api.user

View File

@ -9,10 +9,11 @@ from flask import request
from flask import Response
from flask_bpmn.api.api_error import ApiError
from flask_bpmn.models.db import db
from sqlalchemy.exc import IntegrityError
from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.models.user_group_assignment import UserGroupAssignmentModel
from sqlalchemy.exc import IntegrityError
APPLICATION_JSON: Final = "application/json"

View File

@ -2,6 +2,7 @@
from typing import Any
from flask import g
from spiffworkflow_backend.models.script_attributes_context import (
ScriptAttributesContext,
)

View File

@ -2,6 +2,7 @@
from typing import Any
from flask import current_app
from spiffworkflow_backend.models.script_attributes_context import (
ScriptAttributesContext,
)

View File

@ -4,6 +4,7 @@ from typing import Any
import pytz
from flask_bpmn.api.api_error import ApiError
from spiffworkflow_backend.models.script_attributes_context import (
ScriptAttributesContext,
)

View File

@ -9,6 +9,7 @@ from typing import Any
from typing import Callable
from flask_bpmn.api.api_error import ApiError
from spiffworkflow_backend.models.script_attributes_context import (
ScriptAttributesContext,
)

View File

@ -4,9 +4,10 @@ import time
from flask import current_app
from flask_bpmn.models.db import db
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
from spiffworkflow_backend.models.process_instance import ProcessInstanceStatus
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
def load_acceptance_test_fixtures() -> list[ProcessInstanceModel]:

View File

@ -11,9 +11,10 @@ from flask import current_app
from flask import redirect
from flask_bpmn.api.api_error import ApiError
from flask_bpmn.models.db import db
from spiffworkflow_backend.models.refresh_token import RefreshTokenModel
from werkzeug.wrappers import Response
from spiffworkflow_backend.models.refresh_token import RefreshTokenModel
class AuthenticationProviderTypes(enum.Enum):
"""AuthenticationServiceProviders."""

View File

@ -11,6 +11,8 @@ from flask import request
from flask_bpmn.api.api_error import ApiError
from flask_bpmn.models.db import db
from SpiffWorkflow.task import Task as SpiffTask # type: ignore
from sqlalchemy import text
from spiffworkflow_backend.models.active_task import ActiveTaskModel
from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.models.permission_assignment import PermissionAssignmentModel
@ -25,7 +27,6 @@ from spiffworkflow_backend.services.process_instance_processor import (
ProcessInstanceProcessor,
)
from spiffworkflow_backend.services.user_service import UserService
from sqlalchemy import text
class PermissionsFileNotSetError(Exception):

View File

@ -1,5 +1,6 @@
"""Background_processing_service."""
import flask
from spiffworkflow_backend.services.message_service import MessageService
from spiffworkflow_backend.services.process_instance_service import (
ProcessInstanceService,

View File

@ -1,5 +1,6 @@
"""Data_setup_service."""
from flask import current_app
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from spiffworkflow_backend.services.spec_file_service import SpecFileService

View File

@ -5,6 +5,7 @@ from typing import Union
from flask_bpmn.api.api_error import ApiError
from flask_bpmn.models.db import db
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
from spiffworkflow_backend.models.process_instance import ProcessInstanceStatus
from spiffworkflow_backend.services.email_service import EmailService

View File

@ -7,6 +7,7 @@ from typing import Optional
import pytz
from flask import current_app
from flask_bpmn.api.api_error import ApiError
from spiffworkflow_backend.models.file import CONTENT_TYPES
from spiffworkflow_backend.models.file import File
from spiffworkflow_backend.models.file import FileType

View File

@ -2,6 +2,7 @@
import os
from flask import current_app
from spiffworkflow_backend.models.process_model import ProcessModelInfo
from spiffworkflow_backend.services.file_system_service import FileSystemService

View File

@ -2,6 +2,7 @@
from typing import Optional
from flask_bpmn.models.db import db
from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.services.user_service import UserService

View File

@ -8,6 +8,7 @@ from typing import Optional
from flask import g
from flask.app import Flask
from flask_bpmn.models.db import db
from spiffworkflow_backend.models.spiff_logging import SpiffLoggingModel

View File

@ -3,6 +3,10 @@ from typing import Any
from typing import Optional
from flask_bpmn.models.db import db
from sqlalchemy import and_
from sqlalchemy import or_
from sqlalchemy import select
from spiffworkflow_backend.models.message_correlation import MessageCorrelationModel
from spiffworkflow_backend.models.message_correlation_message_instance import (
MessageCorrelationMessageInstanceModel,
@ -19,9 +23,6 @@ from spiffworkflow_backend.services.process_instance_processor import (
from spiffworkflow_backend.services.process_instance_service import (
ProcessInstanceService,
)
from sqlalchemy import and_
from sqlalchemy import or_
from sqlalchemy import select
class MessageServiceError(Exception):

View File

@ -65,6 +65,7 @@ from SpiffWorkflow.spiff.serializer.task_spec_converters import UserTaskConverte
from SpiffWorkflow.task import Task as SpiffTask # type: ignore
from SpiffWorkflow.task import TaskState
from SpiffWorkflow.util.deep_merge import DeepMerge # type: ignore
from spiffworkflow_backend.models.active_task import ActiveTaskModel
from spiffworkflow_backend.models.active_task_user import ActiveTaskUserModel
from spiffworkflow_backend.models.bpmn_process_id_lookup import BpmnProcessIdLookup

View File

@ -7,6 +7,7 @@ from flask import current_app
from flask_bpmn.api.api_error import ApiError
from flask_bpmn.models.db import db
from SpiffWorkflow.task import Task as SpiffTask # type: ignore
from spiffworkflow_backend.models.process_instance import ProcessInstanceApi
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
from spiffworkflow_backend.models.process_instance import ProcessInstanceStatus

View File

@ -8,6 +8,7 @@ from typing import Optional
from typing import TypeVar
from flask_bpmn.api.api_error import ApiError
from spiffworkflow_backend.exceptions.process_entity_not_found_error import (
ProcessEntityNotFoundError,
)
@ -160,7 +161,9 @@ class ProcessModelService(FileSystemService):
process_models.sort()
return process_models
def get_process_groups(self, process_group_id: Optional[str] = None) -> list[ProcessGroup]:
def get_process_groups(
self, process_group_id: Optional[str] = None
) -> list[ProcessGroup]:
"""Returns the process_groups as a list in display order."""
process_groups = self.__scan_process_groups(process_group_id)
process_groups.sort()
@ -254,7 +257,9 @@ class ProcessModelService(FileSystemService):
index += 1
return process_groups
def __scan_process_groups(self, process_group_id: Optional[str] = None) -> list[ProcessGroup]:
def __scan_process_groups(
self, process_group_id: Optional[str] = None
) -> list[ProcessGroup]:
"""__scan_process_groups."""
if not os.path.exists(FileSystemService.root_path()):
return [] # Nothing to scan yet. There are no files.
@ -303,9 +308,7 @@ class ProcessModelService(FileSystemService):
if self.is_group(nested_item.path):
# This is a nested group
process_group.process_groups.append(
self.__scan_process_group(
nested_item.path
)
self.__scan_process_group(nested_item.path)
)
elif self.is_model(nested_item.path):
process_group.process_models.append(

View File

@ -8,6 +8,7 @@ from typing import Optional
from SpiffWorkflow.bpmn.exceptions import WorkflowTaskExecException # type: ignore
from SpiffWorkflow.task import Task as SpiffTask # type: ignore
from spiffworkflow_backend.services.process_instance_processor import (
CustomBpmnScriptEngine,
)

View File

@ -3,6 +3,7 @@ from typing import Optional
from flask_bpmn.api.api_error import ApiError
from flask_bpmn.models.db import db
from spiffworkflow_backend.models.secret_model import SecretModel
# from cryptography.fernet import Fernet

View File

@ -5,6 +5,7 @@ from typing import Any
import requests
from flask import current_app
from flask import g
from spiffworkflow_backend.services.file_system_service import FileSystemService
from spiffworkflow_backend.services.secret_service import SecretService

View File

@ -12,6 +12,7 @@ from lxml import etree # type: ignore
from lxml.etree import _Element # type: ignore
from lxml.etree import Element as EtreeElement
from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException # type: ignore
from spiffworkflow_backend.models.bpmn_process_id_lookup import BpmnProcessIdLookup
from spiffworkflow_backend.models.file import File
from spiffworkflow_backend.models.file import FileReference

View File

@ -6,6 +6,7 @@ from flask import current_app
from flask import g
from flask_bpmn.api.api_error import ApiError
from flask_bpmn.models.db import db
from spiffworkflow_backend.models.active_task import ActiveTaskModel
from spiffworkflow_backend.models.active_task_user import ActiveTaskUserModel
from spiffworkflow_backend.models.group import GroupModel

View File

@ -21,4 +21,4 @@
]
}
}
}
}

View File

@ -9,5 +9,3 @@
},
"ui:order": ["name", "department"]
}

View File

@ -8,10 +8,12 @@ from typing import Dict
from typing import Optional
from flask import current_app
from flask.app import Flask
from flask.testing import FlaskClient
from flask_bpmn.api.api_error import ApiError
from flask_bpmn.models.db import db
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from werkzeug.test import TestResponse # type: ignore
from spiffworkflow_backend.models.permission_assignment import Permission
from spiffworkflow_backend.models.permission_target import PermissionTargetModel
from spiffworkflow_backend.models.process_group import ProcessGroup
@ -25,8 +27,6 @@ from spiffworkflow_backend.services.authorization_service import AuthorizationSe
from spiffworkflow_backend.services.file_system_service import FileSystemService
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from spiffworkflow_backend.services.user_service import UserService
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from werkzeug.test import TestResponse # type: ignore
# from tests.spiffworkflow_backend.helpers.test_data import logged_in_headers

View File

@ -4,6 +4,7 @@ import os
from typing import Optional
from flask import current_app
from spiffworkflow_backend.models.process_model import ProcessModelInfo
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from spiffworkflow_backend.services.spec_file_service import SpecFileService

View File

@ -1,13 +1,14 @@
"""User."""
from typing import Optional
from tests.spiffworkflow_backend.helpers.example_data import ExampleDataLoader
from spiffworkflow_backend.exceptions.process_entity_not_found_error import (
ProcessEntityNotFoundError,
)
from spiffworkflow_backend.models.process_group import ProcessGroup
from spiffworkflow_backend.models.process_model import ProcessModelInfo
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from tests.spiffworkflow_backend.helpers.example_data import ExampleDataLoader
def assure_process_group_exists(process_group_id: Optional[str] = None) -> ProcessGroup:

View File

@ -2,10 +2,11 @@
import ast
import base64
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.services.authentication_service import (
AuthenticationService,
)
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
class TestAuthentication(BaseTest):

View File

@ -1,9 +1,10 @@
"""Test_logging_service."""
from flask.app import Flask
from flask.testing import FlaskClient
from spiffworkflow_backend.models.user import UserModel
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.models.user import UserModel
class TestLoggingService(BaseTest):
"""Test logging service."""

View File

@ -3,6 +3,8 @@ import json
from flask.app import Flask
from flask.testing import FlaskClient
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.models.process_group import ProcessGroup
from spiffworkflow_backend.models.process_group import ProcessGroupSchema
from spiffworkflow_backend.models.process_model import ProcessModelInfo
@ -11,7 +13,6 @@ from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.process_instance_service import (
ProcessInstanceService,
)
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
class TestNestedGroups(BaseTest):

View File

@ -9,6 +9,9 @@ import pytest
from flask.app import Flask
from flask.testing import FlaskClient
from flask_bpmn.models.db import db
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.exceptions.process_entity_not_found_error import (
ProcessEntityNotFoundError,
)
@ -32,8 +35,6 @@ from spiffworkflow_backend.services.process_instance_service import (
ProcessInstanceService,
)
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
# from spiffworkflow_backend.services.git_service import GitService
@ -622,7 +623,9 @@ class TestProcessApi(BaseTest):
with_super_admin_user: UserModel,
) -> None:
"""Test_process_model_file_update."""
process_model_identifier = self.create_group_and_model_with_bpmn(client, with_super_admin_user)
process_model_identifier = self.create_group_and_model_with_bpmn(
client, with_super_admin_user
)
modified_process_model_id = process_model_identifier.replace("/", ":")
data = {"key1": "THIS DATA"}
@ -646,7 +649,9 @@ class TestProcessApi(BaseTest):
with_super_admin_user: UserModel,
) -> None:
"""Test_process_model_file_update."""
process_model_identifier = self.create_group_and_model_with_bpmn(client, with_super_admin_user)
process_model_identifier = self.create_group_and_model_with_bpmn(
client, with_super_admin_user
)
modified_process_model_id = process_model_identifier.replace("/", ":")
data = {"file": (io.BytesIO(b""), "random_fact.svg")}
@ -722,7 +727,9 @@ class TestProcessApi(BaseTest):
with_super_admin_user: UserModel,
) -> None:
"""Test_process_model_file_update."""
process_model_identifier = self.create_group_and_model_with_bpmn(client, with_super_admin_user)
process_model_identifier = self.create_group_and_model_with_bpmn(
client, with_super_admin_user
)
# self.create_spec_file(client, user=with_super_admin_user)
# process_model = load_test_spec("random_fact")
@ -748,7 +755,9 @@ class TestProcessApi(BaseTest):
with_super_admin_user: UserModel,
) -> None:
"""Test_process_model_file_update."""
process_model_identifier = self.create_group_and_model_with_bpmn(client, with_super_admin_user)
process_model_identifier = self.create_group_and_model_with_bpmn(
client, with_super_admin_user
)
modified_process_model_identifier = process_model_identifier.replace("/", ":")
response = client.delete(
@ -769,7 +778,9 @@ class TestProcessApi(BaseTest):
with_super_admin_user: UserModel,
) -> None:
"""Test_process_model_file_update."""
process_model_identifier = self.create_group_and_model_with_bpmn(client, with_super_admin_user)
process_model_identifier = self.create_group_and_model_with_bpmn(
client, with_super_admin_user
)
modified_process_model_identifier = process_model_identifier.replace("/", ":")
response = client.delete(
@ -796,7 +807,9 @@ class TestProcessApi(BaseTest):
with_super_admin_user: UserModel,
) -> None:
"""Test_get_file."""
process_model_identifier = self.create_group_and_model_with_bpmn(client, with_super_admin_user)
process_model_identifier = self.create_group_and_model_with_bpmn(
client, with_super_admin_user
)
modified_process_model_identifier = process_model_identifier.replace("/", ":")
response = client.get(
@ -816,7 +829,9 @@ class TestProcessApi(BaseTest):
with_super_admin_user: UserModel,
) -> None:
"""Test_get_workflow_from_workflow_spec."""
process_model_identifier = self.create_group_and_model_with_bpmn(client, with_super_admin_user)
process_model_identifier = self.create_group_and_model_with_bpmn(
client, with_super_admin_user
)
modified_process_model_identifier = process_model_identifier.replace("/", ":")
response = client.post(
@ -871,7 +886,9 @@ class TestProcessApi(BaseTest):
with_super_admin_user: UserModel,
) -> None:
"""Test_get_process_group_when_found."""
process_model_identifier = self.create_group_and_model_with_bpmn(client, with_super_admin_user)
process_model_identifier = self.create_group_and_model_with_bpmn(
client, with_super_admin_user
)
process_group_id, process_model_id = os.path.split(process_model_identifier)
response = client.get(
@ -937,7 +954,9 @@ class TestProcessApi(BaseTest):
"""Test_process_instance_create."""
test_process_model_id = "runs_without_input/sample"
headers = self.logged_in_headers(with_super_admin_user)
response = self.create_process_instance_from_process_model_id(client, test_process_model_id, headers)
response = self.create_process_instance_from_process_model_id(
client, test_process_model_id, headers
)
assert response.json is not None
assert response.json["updated_at_in_seconds"] is not None
assert response.json["status"] == "not_started"
@ -1305,7 +1324,9 @@ class TestProcessApi(BaseTest):
)
headers = self.logged_in_headers(with_super_admin_user)
self.create_process_instance_from_process_model_id(client, process_model_identifier, headers)
self.create_process_instance_from_process_model_id(
client, process_model_identifier, headers
)
response = client.get(
"/v1.0/process-instances",
@ -1350,11 +1371,21 @@ class TestProcessApi(BaseTest):
bpmn_file_location=bpmn_file_location,
)
headers = self.logged_in_headers(with_super_admin_user)
self.create_process_instance_from_process_model_id(client, process_model_identifier, headers)
self.create_process_instance_from_process_model_id(client, process_model_identifier, headers)
self.create_process_instance_from_process_model_id(client, process_model_identifier, headers)
self.create_process_instance_from_process_model_id(client, process_model_identifier, headers)
self.create_process_instance_from_process_model_id(client, process_model_identifier, headers)
self.create_process_instance_from_process_model_id(
client, process_model_identifier, headers
)
self.create_process_instance_from_process_model_id(
client, process_model_identifier, headers
)
self.create_process_instance_from_process_model_id(
client, process_model_identifier, headers
)
self.create_process_instance_from_process_model_id(
client, process_model_identifier, headers
)
self.create_process_instance_from_process_model_id(
client, process_model_identifier, headers
)
response = client.get(
"/v1.0/process-instances?per_page=2&page=3",
@ -1657,7 +1688,9 @@ class TestProcessApi(BaseTest):
) -> Any:
"""Setup_testing_instance."""
headers = self.logged_in_headers(with_super_admin_user)
response = self.create_process_instance_from_process_model_id(client, process_model_id, headers)
response = self.create_process_instance_from_process_model_id(
client, process_model_id, headers
)
process_instance = response.json
assert isinstance(process_instance, dict)
process_instance_id = process_instance["id"]

View File

@ -6,14 +6,15 @@ import pytest
from flask.app import Flask
from flask.testing import FlaskClient
from flask_bpmn.api.api_error import ApiError
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from werkzeug.test import TestResponse # type: ignore
from spiffworkflow_backend.models.process_model import ProcessModelInfo
from spiffworkflow_backend.models.secret_model import SecretModel
from spiffworkflow_backend.models.secret_model import SecretModelSchema
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from spiffworkflow_backend.services.secret_service import SecretService
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from werkzeug.test import TestResponse # type: ignore
class SecretServiceTestHelpers(BaseTest):

View File

@ -2,14 +2,15 @@
from flask.app import Flask
from flask.testing import FlaskClient
from flask_bpmn.models.db import db
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.process_instance_processor import (
ProcessInstanceProcessor,
)
from spiffworkflow_backend.services.user_service import UserService
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
class TestGetGroupMembers(BaseTest):

View File

@ -4,6 +4,9 @@ import datetime
import pytz
from flask.app import Flask
from flask.testing import FlaskClient
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.models.script_attributes_context import (
ScriptAttributesContext,
)
@ -14,8 +17,6 @@ from spiffworkflow_backend.services.process_instance_processor import (
from spiffworkflow_backend.services.process_instance_service import (
ProcessInstanceService,
)
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
class TestGetLocaltime(BaseTest):

View File

@ -1,5 +1,6 @@
"""Test_acceptance_test_fixtures."""
from flask.app import Flask
from spiffworkflow_backend.services.acceptance_test_fixtures import (
load_acceptance_test_fixtures,
)

View File

@ -2,6 +2,8 @@
import pytest
from flask import Flask
from flask.testing import FlaskClient
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.models.user import UserNotFoundError
from spiffworkflow_backend.services.authorization_service import AuthorizationService
@ -12,7 +14,6 @@ from spiffworkflow_backend.services.process_instance_service import (
ProcessInstanceService,
)
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
class TestAuthorizationService(BaseTest):

View File

@ -1,6 +1,8 @@
"""Test_various_bpmn_constructs."""
from flask.app import Flask
from flask.testing import FlaskClient
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.process_instance_processor import (
ProcessInstanceProcessor,
@ -8,7 +10,6 @@ from spiffworkflow_backend.services.process_instance_processor import (
from spiffworkflow_backend.services.process_instance_service import (
ProcessInstanceService,
)
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
class TestDotNotation(BaseTest):

View File

@ -1,9 +1,10 @@
"""Test_environment_var_script."""
from flask import Flask
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.services.process_instance_processor import (
ProcessInstanceProcessor,
)
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
class TestEnvironmentVarScript(BaseTest):

View File

@ -3,11 +3,12 @@ import pytest
from flask import Flask
from flask.testing import FlaskClient
from flask_bpmn.models.db import db
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.models.message_instance import MessageInstanceModel
from spiffworkflow_backend.models.message_model import MessageModel
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
class TestMessageInstance(BaseTest):

View File

@ -1,6 +1,9 @@
"""Test_message_service."""
from flask import Flask
from flask.testing import FlaskClient
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.models.message_correlation import MessageCorrelationModel
from spiffworkflow_backend.models.message_correlation_message_instance import (
MessageCorrelationMessageInstanceModel,
@ -15,8 +18,6 @@ from spiffworkflow_backend.services.process_instance_processor import (
from spiffworkflow_backend.services.process_instance_service import (
ProcessInstanceService,
)
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
class TestMessageService(BaseTest):

View File

@ -2,11 +2,12 @@
import pytest
from flask.app import Flask
from flask_bpmn.models.db import db
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.models.permission_target import (
InvalidPermissionTargetUriError,
)
from spiffworkflow_backend.models.permission_target import PermissionTargetModel
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
class TestPermissionTarget(BaseTest):

View File

@ -2,14 +2,15 @@
from flask.app import Flask
from flask.testing import FlaskClient
from flask_bpmn.models.db import db
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.models.permission_assignment import PermissionAssignmentModel
from spiffworkflow_backend.models.permission_target import PermissionTargetModel
from spiffworkflow_backend.models.principal import PrincipalModel
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.user_service import UserService
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
# we think we can get the list of roles for a user.

View File

@ -1,5 +1,6 @@
"""Process Model."""
from flask.app import Flask
from spiffworkflow_backend.models.process_group import ProcessGroup
from spiffworkflow_backend.services.process_model_service import ProcessModelService

View File

@ -3,6 +3,9 @@ import pytest
from flask import g
from flask.app import Flask
from flask.testing import FlaskClient
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.models.group import GroupModel
from spiffworkflow_backend.models.process_instance import ProcessInstanceStatus
from spiffworkflow_backend.models.user import UserModel
@ -16,8 +19,6 @@ from spiffworkflow_backend.services.process_instance_processor import (
from spiffworkflow_backend.services.process_instance_service import (
ProcessInstanceService,
)
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
class TestProcessInstanceProcessor(BaseTest):

View File

@ -2,11 +2,12 @@
from typing import Optional
from flask.app import Flask
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
from spiffworkflow_backend.models.process_instance_report import (
ProcessInstanceReportModel,
)
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
# from tests.spiffworkflow_backend.helpers.test_data import find_or_create_process_group
# from spiffworkflow_backend.models.permission_assignment import PermissionAssignmentModel

View File

@ -2,14 +2,15 @@
from flask.app import Flask
from flask.testing import FlaskClient
from flask_bpmn.models.db import db
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.models.bpmn_process_id_lookup import BpmnProcessIdLookup
from spiffworkflow_backend.models.process_model import ProcessModelInfo
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.process_instance_processor import (
ProcessInstanceProcessor,
)
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
class TestProcessModel(BaseTest):

View File

@ -1,11 +1,12 @@
"""Test_process_model_service."""
from flask import Flask
from flask.testing import FlaskClient
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.process_model_service import ProcessModelService
class TestProcessModelService(BaseTest):
"""TestProcessModelService."""

View File

@ -3,12 +3,13 @@ import pytest
from flask.app import Flask
from flask.testing import FlaskClient
from flask_bpmn.api.api_error import ApiError
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.process_instance_processor import (
ProcessInstanceProcessor,
)
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
class TestOpenFile(BaseTest):

View File

@ -1,14 +1,15 @@
"""Test Permissions."""
from flask.app import Flask
from flask.testing import FlaskClient
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.process_instance_processor import (
ProcessInstanceProcessor,
)
from spiffworkflow_backend.services.script_unit_test_runner import PythonScriptContext
from spiffworkflow_backend.services.script_unit_test_runner import ScriptUnitTestRunner
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
class TestScriptUnitTestRunner(BaseTest):

View File

@ -1,8 +1,9 @@
"""Test_various_bpmn_constructs."""
from flask.app import Flask
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.services.secret_service import SecretService
from spiffworkflow_backend.services.service_task_service import ServiceTaskDelegate
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
class TestServiceTaskDelegate(BaseTest):

View File

@ -7,12 +7,13 @@ from flask.testing import FlaskClient
from flask_bpmn.api.api_error import ApiError
from flask_bpmn.models.db import db
from SpiffWorkflow.dmn.parser.BpmnDmnParser import BpmnDmnParser # type: ignore
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.models.bpmn_process_id_lookup import BpmnProcessIdLookup
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from spiffworkflow_backend.services.spec_file_service import SpecFileService
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
class TestSpecFileService(BaseTest):

View File

@ -3,10 +3,11 @@ from decimal import Decimal
from flask.app import Flask
from flask_bpmn.models.db import db
from spiffworkflow_backend.models.spiff_logging import SpiffLoggingModel
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.models.spiff_logging import SpiffLoggingModel
class TestSpiffLogging(BaseTest):
"""TestSpiffLogging."""

View File

@ -1,12 +1,13 @@
"""Test_various_bpmn_constructs."""
from flask.app import Flask
from flask.testing import FlaskClient
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.process_instance_processor import (
ProcessInstanceProcessor,
)
from spiffworkflow_backend.services.process_model_service import ProcessModelService
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
class TestVariousBpmnConstructs(BaseTest):

View File

@ -1,6 +1,7 @@
"""Test cases for the __main__ module."""
import pytest
from click.testing import CliRunner
from spiffworkflow_backend import __main__