2022-10-12 10:22:22 -04:00
|
|
|
"""Conftest."""
|
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
from flask.app import Flask
|
2022-11-09 15:02:19 -05:00
|
|
|
from flask.testing import FlaskClient
|
2022-10-12 10:22:22 -04:00
|
|
|
from flask_bpmn.models.db import db
|
|
|
|
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
|
2022-10-31 09:28:03 -04:00
|
|
|
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
|
|
|
|
|
Squashed 'spiffworkflow-backend/' changes from 7600e1e57..094de3563
094de3563 pyl w/ burnettk
7575ce459 Merge pull request #95 from sartography/feature/find_by_process_instance_id
bb3c9ebea fixed test w/ burnettk
4b8b5fc40 added fix to SpiffWorkflow to deepcopy operation params before evaluating them w/ burnettk
08909ae93 Add get_secret script (#94)
158cbb4bf basic support to find a process instance by id w/ burnettk
49a71d898 pyl w/ burnettk
3d87cc56a Merge branch 'main' into feature/process-nav-improvements
13ef0ab87 fixed issue displaying task data for call activities called multiple times in a diagram w/ burnettk
e99caf034 Merge branch 'main' into feature/process-nav-improvements
e64fe5eee add a bit more debugging info
f4907aeab pyl
ac079f881 added ability to filter process instances by process initiator
9d848effa pyl w/ burnettk
7ae3dca55 added process group display name to model search and cache the groups to avoid extra lookups w/ burnettk
fc30bd843 merged in main and resolved conflicts
9f036a1d0 Helper function to support reaping process instances (#91)
29fb40b3f pyl w/ burnettk
10e2ea6f9 added new page to create process models using english text w/ burnettk
7f9422ce2 added method to create process models based on english string w/ burnettk
8de7d1378 upgrade black, give it the preview flag, and let it rip on long strings
9310c8eec configure metadata extration paths appropriately
2adb6b206 actually create process model
afd6bcbc3 added basis of api to create process models from text w/ burnettk
141b19241 reformat file
119f2513e remove reset tasks from human task table
244c6178a added all users to waiting for column on task list tables w/ burnettk
787e1e1ee fix method overwritten by merge
8dd2457ce Merge branch 'main' into feature/process-nav-improvements
dab22e0ec ensure we get logs for both db and backend with docker compose w/ burnettk
a2aa3ae4f remove unused task method
ad17ca3f5 allow tests to determine what paginated entity id to use to determine a table has loaded
1fcaf8bdb create spiff steps for manual navigation
0bc9ae6f6 Merge remote-tracking branch 'origin/main' into feature/process_api_blueprint_refactor
71475ddf8 Merge pull request #78 from sartography/feature/process-navigation
534e2d468 move helpers where they belong
22cdc28a8 run ./bin/run_pyl
55eedd28c new service tasks controller
439106265 move status to health controller
e0f7da69a fix test
accde5d4e move helpers where they belong
524434a10 allow option to complete single tasks with or without execution
865fd6c8c get tests passing
7faf753e6 moved some more apis w/ burnettk
aa87d68d5 moved more api methods to own controllers w/ burnettk
6b78eddc8 add endpoint to reset process to earlier step
be5580a92 moved process groups, models, and instances api methods to own controller files w/ burnettk
3933c92a5 fix bug with opening call activities when processes conflict with dmn files
76c71a7e5 fix show previous spiff steps
7f09a92eb Minor fix to SpiffWorkflow library
d3136f8e4 Don't freak out if git is not yet setup in the working directory.
83e468d43 Merge branch 'main' into feature/process-navigation
42393d8d7 Make list available to script tasks (#86)
0972d9790 save the process instance even if it fails to run all the way w/ burnettk
626db0d78 delete human tasks when process instance is deleted w/ burnettk
1a71a44b5 Merge branch 'main' of github.com:sartography/spiff-arena
0cc6f2c2d fixed some cypress tests and fixed issue where an invalid date caused the page to constantly reload w/ burnettk
07a977f02 Revive report deletion (#85)
8aafd69db do not delete groups that were just added w/ burnettk
f4b01d957 update flask-bpmn w/ burnettk
b33947bda some cypress tests w/ burnettk
c56a2b0d7 update flask-bpmn w/ burnettk
e3d381a23 log api errors when sending to sentry w/ burnettk
568c2b7f2 give read access to process-data for all permission macro w/ burnettk
bf1ecb87d added ability to view data objects from the process instance show page w/ burnettk
2ba416f58 dev permissions copied from terraform deployed and terraform deployed now tiny, minor fixes
18ae75fa5 link to correct instances page, fix fin users, ignore coverage files
25022c35f trim down granted permissions to just the ones that exist in the API, improve output of permissions
3fd9aafe0 use spiffworkflow.org for admin and other minor permissions tweaks
fbfc0f118 fix flask bpmn poetry lock and change admin email to spiffworkflow.org
cd623fc97 fix qa1 and add script to get perms
8ed7800e5 lint and regen schema
0e8f6fc04 50 is not long enough to store our keycloak urls
3178909c1 add qa1 env
ffcfa7b37 added test to check only privileged users can call refresh_permissions w/ burnettk
833976ef0 updated permission yamls to have email addresses and look more the same w/ burnettk
73356471b pyl passes w/ burnettk
533beee8b removed scripts for permissions since that code has been mostly moved and superseded by refresh_permissions w/ burnettk
be228d405 added script to refresh permissions w/ burnettk
2b5d03beb pyl w/ burnettk
0ad370896 added script to get all permissions for the confirmation page when adding permissions from a process model w/ burnettk
d67ec1687 added test to for permission to process group w/ burnettk
f4558b616 fixed slashes to colons in permission macros w/ burnettk
a56734226 pyl
e3b9e127c added ALL macro for easier use with admin groups and some failure test cases
2a5954109 added remaining tests for current permission macros
f669d19ea added test for perm macros w/ burnettk
b73699e69 added method to add permissions based on macros w/ burnettk
4ac265433 Merge remote-tracking branch 'origin/main' into feature/bpmn_user_permissions
d45860254 minor tweak to test bpmn w/ burnettk
1c027df7c Merge branch 'main' of github.com:sartography/spiff-arena into main
91630588f Do not require a Git Repository to start a process.
d12696fcd do not force permissions to use the v1.0 path prefix but it can be used if desired w/ burnettk
7756165b0 pyl w/ burnettk
dc2a976b9 default requiring permissions to run a script to True w/ burnettk
71c4a2fdc added permission to run privileged scripts w/ burnettk
1033159b2 Merge pull request #79 from sartography/feature/better_unit_tests
6b886663f Merge remote-tracking branch 'origin/main' into feature/bpmn_user_permissions
c49355dec pyl fixed w/ burnettk
068c3f133 fixed get tasks and process instances by group w/ burnettk
66ebe1ad2 pyl w/ burnettk
a7256622d fixed completed instances filter w/ burnettk
0f18bb798 merged in main and resolved conflicts w/ burnettk
6a578b6f4 a little refactor w/ burnettk
f9fa7e514 set the completed by user on human task w/ burnettk
be47b7352 added remaining filter tests w/ burnettk
0d3506944 added another filter test
578481416 added test for report filters w/ burnettk
6cb0b068b reformat file again
e5a803f2b renamed test process instance create method w/ burnettk
4d2796fac some initial changes to refactor report filters w/ burnettk
e0ce9f71e fix more bs errors
e1d132cf6 fix lint errors
ca9587f1a fix conflicts for like the thousandth time
84749f194 fix filtering issue on completed instances tab and lint junk
3c2b71549 fix getting task info for a process instance w/ burnettk
90a5b0c31 added correct process instance permissions w/ burnettk
af03e4823 renamed active task to human task since we are no longer deleting them w/ burnettk
86cb5d77a created process instance list and show pages to handle all and for-me w/ burnettk
ec492b3cf fix conflicts yet again
6c64e7312 merged in main and resolved conflicts w/ burnettk
d4ef203da give everybody crud for reports w/ burnettk
a6a84beae fixed file upload and do not allow submitting task data to a suspended process instance w/ burnettk
bd835f980 fix typing problem
76481f57c updates to disallow modifying a process instance when it is not in the correct state w/ burnettk
b9642bfdf do not allow editing task data for process instances that are not suspended and some code cleanup w/ burnettk
a7fb08b11 add integration tests for process nav endpoints
51cfe2417 added updated and created at columns on user w/ burnettk
20f378922 set the auth header when calling git commit w/ burnettk
8ebd5f5b1 Fixing some tests.
3d769e185 Merge remote-tracking branch 'origin/main' into feature/bpmn_user_permissions
d24b53b7a Adding tests for the user service , and closing a few logic errors. Adding support for a single wild card for matching all users.
71a154db1 allow marking task complete without executing
b08496f4b fix conflicts again
d358f0e70 fix tests
f81851122 added completed column to active task w/ burnettk
10c92cd58 update url to allow permissions on send event
a32bf8993 some basic stuff for showing only relating items to user w/ burnettk
87b5d9aff fixed permissions w/ burnettk
ecc70c189 Merge remote-tracking branch 'origin/main' into feature/bpmn_user_permissions
07c5fe2e9 add a test group and put natalia in it
e2a7a5de2 updated some text for task tables w/ burnettk
d0fbd20ee merged in main and resolved conflicts w/ burnettk
609343d06 updated flask-bpmn so it does not send invalid token exceptions to sentry w/ burnettk
cd36bff52 Merge remote-tracking branch 'origin/main' into feature/better_unit_tests
06ea528c1 fix conflicts & update event url to match other process instance urls
3697c86c2 Merge branch 'feature/better_unit_tests' into feature/bpmn_user_permissions
b7d6448b8 Fixes a bug that was causing tests to be added to the incorrect task. Clean up UI for a better experience when viewing tests.
20f445d85 Updated migrations.
a75a5407e When loading permissions and the user does not exist, add records to the UserGroupAssignmentWaiting table that can be picked up later. Request "profile" scope over OpenID so we can get a few more bits of information when avilable. Add a "clear_perissions" script Add an "add_permissions" script Add an "add_permissions" script When logging in for the first time, check for any awaiting permissions and assign them. Add "enumerate" as a whitelisted function to React Schema Add a "display_name" to the user table
e10cb73f7 reformat & fix types
68c4aa2db Merge branch 'main' into feature/process-navigation
8f233106e Merge remote-tracking branch 'origin/unit_test_404' into feature/bpmn_user_permissions
9af47b207 Fix api endpoints for script unit tests
6c8cbe6f2 working but barely functional UI for manually sending events
a9673dd4b Assure our open-id system can return emails. Update our data from Open ID Systems when users log in
a66591833 Removing two fields from user table that were not used (uid, name) Request email from open id clients, as this would provide a handy way to uniquely reference users when assigning to groups. During Login do a lookup on email if possible -- so that permissions assignments based on email can be connected when sigining in through openid. Don't use "open_id" for the service name on user accounts, use the iss string provided through open id, this will allow us to support more than one open id platform. Update the KeyCloak configuration so it is able to return email addresses for users -- which will make permission assignment easier in the future. Removed several unused commands in the user_service class.
33d68368b split out completed instances by group as well
e7873c5be updated group api so it is not under tasks
88f6ea071 pyl
1582dca2d split group task tables by group and created component for group tables
37a516d99 some base work to try to get display names searchable for process models w/ burnettk
git-subtree-dir: spiffworkflow-backend
git-subtree-split: 094de3563ef9020743aaf116f98cbc8e81b9e5d6
2023-01-05 17:35:21 -05:00
|
|
|
from spiffworkflow_backend.models.human_task_user import HumanTaskUserModel
|
2022-10-12 10:22:22 -04:00
|
|
|
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
|
2022-10-20 16:00:12 -04:00
|
|
|
from spiffworkflow_backend.models.user import UserModel
|
2022-10-12 10:22:22 -04:00
|
|
|
from spiffworkflow_backend.services.process_instance_processor import (
|
|
|
|
ProcessInstanceProcessor,
|
|
|
|
)
|
|
|
|
from spiffworkflow_backend.services.process_instance_service import (
|
|
|
|
ProcessInstanceService,
|
|
|
|
)
|
|
|
|
from spiffworkflow_backend.services.process_model_service import ProcessModelService
|
|
|
|
|
2022-11-09 15:02:19 -05:00
|
|
|
# from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
|
|
|
|
|
2022-10-12 10:22:22 -04:00
|
|
|
|
|
|
|
# We need to call this before importing spiffworkflow_backend
|
|
|
|
# otherwise typeguard cannot work. hence the noqa: E402
|
|
|
|
if os.environ.get("RUN_TYPEGUARD") == "true":
|
|
|
|
from typeguard.importhook import install_import_hook
|
|
|
|
|
|
|
|
install_import_hook(packages="spiffworkflow_backend")
|
|
|
|
|
|
|
|
|
|
|
|
from spiffworkflow_backend import create_app # noqa: E402
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
|
|
def app() -> Flask:
|
|
|
|
"""App."""
|
|
|
|
os.environ["SPIFFWORKFLOW_BACKEND_ENV"] = "testing"
|
|
|
|
os.environ["FLASK_SESSION_SECRET_KEY"] = "super_secret_key"
|
|
|
|
app = create_app()
|
|
|
|
|
|
|
|
return app
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture()
|
|
|
|
def with_db_and_bpmn_file_cleanup() -> None:
|
|
|
|
"""Process_group_resource."""
|
Squashed 'spiffworkflow-backend/' changes from 7600e1e57..094de3563
094de3563 pyl w/ burnettk
7575ce459 Merge pull request #95 from sartography/feature/find_by_process_instance_id
bb3c9ebea fixed test w/ burnettk
4b8b5fc40 added fix to SpiffWorkflow to deepcopy operation params before evaluating them w/ burnettk
08909ae93 Add get_secret script (#94)
158cbb4bf basic support to find a process instance by id w/ burnettk
49a71d898 pyl w/ burnettk
3d87cc56a Merge branch 'main' into feature/process-nav-improvements
13ef0ab87 fixed issue displaying task data for call activities called multiple times in a diagram w/ burnettk
e99caf034 Merge branch 'main' into feature/process-nav-improvements
e64fe5eee add a bit more debugging info
f4907aeab pyl
ac079f881 added ability to filter process instances by process initiator
9d848effa pyl w/ burnettk
7ae3dca55 added process group display name to model search and cache the groups to avoid extra lookups w/ burnettk
fc30bd843 merged in main and resolved conflicts
9f036a1d0 Helper function to support reaping process instances (#91)
29fb40b3f pyl w/ burnettk
10e2ea6f9 added new page to create process models using english text w/ burnettk
7f9422ce2 added method to create process models based on english string w/ burnettk
8de7d1378 upgrade black, give it the preview flag, and let it rip on long strings
9310c8eec configure metadata extration paths appropriately
2adb6b206 actually create process model
afd6bcbc3 added basis of api to create process models from text w/ burnettk
141b19241 reformat file
119f2513e remove reset tasks from human task table
244c6178a added all users to waiting for column on task list tables w/ burnettk
787e1e1ee fix method overwritten by merge
8dd2457ce Merge branch 'main' into feature/process-nav-improvements
dab22e0ec ensure we get logs for both db and backend with docker compose w/ burnettk
a2aa3ae4f remove unused task method
ad17ca3f5 allow tests to determine what paginated entity id to use to determine a table has loaded
1fcaf8bdb create spiff steps for manual navigation
0bc9ae6f6 Merge remote-tracking branch 'origin/main' into feature/process_api_blueprint_refactor
71475ddf8 Merge pull request #78 from sartography/feature/process-navigation
534e2d468 move helpers where they belong
22cdc28a8 run ./bin/run_pyl
55eedd28c new service tasks controller
439106265 move status to health controller
e0f7da69a fix test
accde5d4e move helpers where they belong
524434a10 allow option to complete single tasks with or without execution
865fd6c8c get tests passing
7faf753e6 moved some more apis w/ burnettk
aa87d68d5 moved more api methods to own controllers w/ burnettk
6b78eddc8 add endpoint to reset process to earlier step
be5580a92 moved process groups, models, and instances api methods to own controller files w/ burnettk
3933c92a5 fix bug with opening call activities when processes conflict with dmn files
76c71a7e5 fix show previous spiff steps
7f09a92eb Minor fix to SpiffWorkflow library
d3136f8e4 Don't freak out if git is not yet setup in the working directory.
83e468d43 Merge branch 'main' into feature/process-navigation
42393d8d7 Make list available to script tasks (#86)
0972d9790 save the process instance even if it fails to run all the way w/ burnettk
626db0d78 delete human tasks when process instance is deleted w/ burnettk
1a71a44b5 Merge branch 'main' of github.com:sartography/spiff-arena
0cc6f2c2d fixed some cypress tests and fixed issue where an invalid date caused the page to constantly reload w/ burnettk
07a977f02 Revive report deletion (#85)
8aafd69db do not delete groups that were just added w/ burnettk
f4b01d957 update flask-bpmn w/ burnettk
b33947bda some cypress tests w/ burnettk
c56a2b0d7 update flask-bpmn w/ burnettk
e3d381a23 log api errors when sending to sentry w/ burnettk
568c2b7f2 give read access to process-data for all permission macro w/ burnettk
bf1ecb87d added ability to view data objects from the process instance show page w/ burnettk
2ba416f58 dev permissions copied from terraform deployed and terraform deployed now tiny, minor fixes
18ae75fa5 link to correct instances page, fix fin users, ignore coverage files
25022c35f trim down granted permissions to just the ones that exist in the API, improve output of permissions
3fd9aafe0 use spiffworkflow.org for admin and other minor permissions tweaks
fbfc0f118 fix flask bpmn poetry lock and change admin email to spiffworkflow.org
cd623fc97 fix qa1 and add script to get perms
8ed7800e5 lint and regen schema
0e8f6fc04 50 is not long enough to store our keycloak urls
3178909c1 add qa1 env
ffcfa7b37 added test to check only privileged users can call refresh_permissions w/ burnettk
833976ef0 updated permission yamls to have email addresses and look more the same w/ burnettk
73356471b pyl passes w/ burnettk
533beee8b removed scripts for permissions since that code has been mostly moved and superseded by refresh_permissions w/ burnettk
be228d405 added script to refresh permissions w/ burnettk
2b5d03beb pyl w/ burnettk
0ad370896 added script to get all permissions for the confirmation page when adding permissions from a process model w/ burnettk
d67ec1687 added test to for permission to process group w/ burnettk
f4558b616 fixed slashes to colons in permission macros w/ burnettk
a56734226 pyl
e3b9e127c added ALL macro for easier use with admin groups and some failure test cases
2a5954109 added remaining tests for current permission macros
f669d19ea added test for perm macros w/ burnettk
b73699e69 added method to add permissions based on macros w/ burnettk
4ac265433 Merge remote-tracking branch 'origin/main' into feature/bpmn_user_permissions
d45860254 minor tweak to test bpmn w/ burnettk
1c027df7c Merge branch 'main' of github.com:sartography/spiff-arena into main
91630588f Do not require a Git Repository to start a process.
d12696fcd do not force permissions to use the v1.0 path prefix but it can be used if desired w/ burnettk
7756165b0 pyl w/ burnettk
dc2a976b9 default requiring permissions to run a script to True w/ burnettk
71c4a2fdc added permission to run privileged scripts w/ burnettk
1033159b2 Merge pull request #79 from sartography/feature/better_unit_tests
6b886663f Merge remote-tracking branch 'origin/main' into feature/bpmn_user_permissions
c49355dec pyl fixed w/ burnettk
068c3f133 fixed get tasks and process instances by group w/ burnettk
66ebe1ad2 pyl w/ burnettk
a7256622d fixed completed instances filter w/ burnettk
0f18bb798 merged in main and resolved conflicts w/ burnettk
6a578b6f4 a little refactor w/ burnettk
f9fa7e514 set the completed by user on human task w/ burnettk
be47b7352 added remaining filter tests w/ burnettk
0d3506944 added another filter test
578481416 added test for report filters w/ burnettk
6cb0b068b reformat file again
e5a803f2b renamed test process instance create method w/ burnettk
4d2796fac some initial changes to refactor report filters w/ burnettk
e0ce9f71e fix more bs errors
e1d132cf6 fix lint errors
ca9587f1a fix conflicts for like the thousandth time
84749f194 fix filtering issue on completed instances tab and lint junk
3c2b71549 fix getting task info for a process instance w/ burnettk
90a5b0c31 added correct process instance permissions w/ burnettk
af03e4823 renamed active task to human task since we are no longer deleting them w/ burnettk
86cb5d77a created process instance list and show pages to handle all and for-me w/ burnettk
ec492b3cf fix conflicts yet again
6c64e7312 merged in main and resolved conflicts w/ burnettk
d4ef203da give everybody crud for reports w/ burnettk
a6a84beae fixed file upload and do not allow submitting task data to a suspended process instance w/ burnettk
bd835f980 fix typing problem
76481f57c updates to disallow modifying a process instance when it is not in the correct state w/ burnettk
b9642bfdf do not allow editing task data for process instances that are not suspended and some code cleanup w/ burnettk
a7fb08b11 add integration tests for process nav endpoints
51cfe2417 added updated and created at columns on user w/ burnettk
20f378922 set the auth header when calling git commit w/ burnettk
8ebd5f5b1 Fixing some tests.
3d769e185 Merge remote-tracking branch 'origin/main' into feature/bpmn_user_permissions
d24b53b7a Adding tests for the user service , and closing a few logic errors. Adding support for a single wild card for matching all users.
71a154db1 allow marking task complete without executing
b08496f4b fix conflicts again
d358f0e70 fix tests
f81851122 added completed column to active task w/ burnettk
10c92cd58 update url to allow permissions on send event
a32bf8993 some basic stuff for showing only relating items to user w/ burnettk
87b5d9aff fixed permissions w/ burnettk
ecc70c189 Merge remote-tracking branch 'origin/main' into feature/bpmn_user_permissions
07c5fe2e9 add a test group and put natalia in it
e2a7a5de2 updated some text for task tables w/ burnettk
d0fbd20ee merged in main and resolved conflicts w/ burnettk
609343d06 updated flask-bpmn so it does not send invalid token exceptions to sentry w/ burnettk
cd36bff52 Merge remote-tracking branch 'origin/main' into feature/better_unit_tests
06ea528c1 fix conflicts & update event url to match other process instance urls
3697c86c2 Merge branch 'feature/better_unit_tests' into feature/bpmn_user_permissions
b7d6448b8 Fixes a bug that was causing tests to be added to the incorrect task. Clean up UI for a better experience when viewing tests.
20f445d85 Updated migrations.
a75a5407e When loading permissions and the user does not exist, add records to the UserGroupAssignmentWaiting table that can be picked up later. Request "profile" scope over OpenID so we can get a few more bits of information when avilable. Add a "clear_perissions" script Add an "add_permissions" script Add an "add_permissions" script When logging in for the first time, check for any awaiting permissions and assign them. Add "enumerate" as a whitelisted function to React Schema Add a "display_name" to the user table
e10cb73f7 reformat & fix types
68c4aa2db Merge branch 'main' into feature/process-navigation
8f233106e Merge remote-tracking branch 'origin/unit_test_404' into feature/bpmn_user_permissions
9af47b207 Fix api endpoints for script unit tests
6c8cbe6f2 working but barely functional UI for manually sending events
a9673dd4b Assure our open-id system can return emails. Update our data from Open ID Systems when users log in
a66591833 Removing two fields from user table that were not used (uid, name) Request email from open id clients, as this would provide a handy way to uniquely reference users when assigning to groups. During Login do a lookup on email if possible -- so that permissions assignments based on email can be connected when sigining in through openid. Don't use "open_id" for the service name on user accounts, use the iss string provided through open id, this will allow us to support more than one open id platform. Update the KeyCloak configuration so it is able to return email addresses for users -- which will make permission assignment easier in the future. Removed several unused commands in the user_service class.
33d68368b split out completed instances by group as well
e7873c5be updated group api so it is not under tasks
88f6ea071 pyl
1582dca2d split group task tables by group and created component for group tables
37a516d99 some base work to try to get display names searchable for process models w/ burnettk
git-subtree-dir: spiffworkflow-backend
git-subtree-split: 094de3563ef9020743aaf116f98cbc8e81b9e5d6
2023-01-05 17:35:21 -05:00
|
|
|
db.session.query(HumanTaskUserModel).delete()
|
2022-10-21 16:28:09 -04:00
|
|
|
|
2022-10-12 10:22:22 -04:00
|
|
|
for model in SpiffworkflowBaseDBModel._all_subclasses():
|
|
|
|
db.session.query(model).delete()
|
2022-10-20 16:00:12 -04:00
|
|
|
db.session.commit()
|
2022-10-12 10:22:22 -04:00
|
|
|
|
|
|
|
try:
|
|
|
|
yield
|
|
|
|
finally:
|
|
|
|
process_model_service = ProcessModelService()
|
|
|
|
if os.path.exists(process_model_service.root_path()):
|
|
|
|
shutil.rmtree(process_model_service.root_path())
|
|
|
|
|
|
|
|
|
2022-10-20 16:00:12 -04:00
|
|
|
@pytest.fixture()
|
|
|
|
def with_super_admin_user() -> UserModel:
|
|
|
|
"""With_super_admin_user."""
|
|
|
|
return BaseTest.create_user_with_permission("super_admin")
|
|
|
|
|
|
|
|
|
2022-10-12 10:22:22 -04:00
|
|
|
@pytest.fixture()
|
2022-11-09 15:02:19 -05:00
|
|
|
def setup_process_instances_for_reports(
|
|
|
|
client: FlaskClient, with_super_admin_user: UserModel
|
|
|
|
) -> list[ProcessInstanceModel]:
|
2022-10-12 10:22:22 -04:00
|
|
|
"""Setup_process_instances_for_reports."""
|
2022-11-09 15:02:19 -05:00
|
|
|
user = with_super_admin_user
|
2022-10-12 10:22:22 -04:00
|
|
|
process_group_id = "runs_without_input"
|
|
|
|
process_model_id = "sample"
|
2022-11-09 15:02:19 -05:00
|
|
|
# bpmn_file_name = "sample.bpmn"
|
|
|
|
bpmn_file_location = "sample"
|
2022-11-11 11:40:59 -05:00
|
|
|
process_model_identifier = BaseTest().create_group_and_model_with_bpmn(
|
2022-11-09 15:02:19 -05:00
|
|
|
client,
|
|
|
|
with_super_admin_user,
|
|
|
|
process_group_id=process_group_id,
|
|
|
|
process_model_id=process_model_id,
|
|
|
|
# bpmn_file_name=bpmn_file_name,
|
|
|
|
bpmn_file_location=bpmn_file_location,
|
|
|
|
)
|
|
|
|
|
|
|
|
# BaseTest().create_process_group(
|
|
|
|
# client=client, user=user, process_group_id=process_group_id, display_name=process_group_id
|
|
|
|
# )
|
|
|
|
# process_model_id = "runs_without_input/sample"
|
|
|
|
# load_test_spec(
|
|
|
|
# process_model_id=f"{process_group_id}/{process_model_id}",
|
|
|
|
# process_model_source_directory="sample"
|
|
|
|
# )
|
2022-10-12 10:22:22 -04:00
|
|
|
process_instances = []
|
|
|
|
for data in [kay(), ray(), jay()]:
|
Squashed 'spiffworkflow-backend/' changes from c1ecc9035..ecbe97049
ecbe97049 comment out test not working in CI
942c18fa3 indicate main explicitly for ci
3cd57a1c8 pyl w/ burnettk
5b2917a59 update staging configs to allow env var overrides w/ burnettk
7645a5f8d need to set upstream when git pushing w/ burnettk
0413f3cdf added secret verification to webhook endpoint w/ burnettk
e7576d7ee fixed broken test w/ burnettk
bf507f8fc fixed mypy issue w/ burnettk
7c6e5c306 Merge branch 'main' of github.com:sartography/spiff-arena
87c986df0 cleaned up the git service and expanded the api git hook w/ burnettk
c7322f3c8 Sort primary file to top of files list (#71)
089d7d5e2 note
aa6fe8286 add skeleton of endpoint to receive github webhooks
7b9e99ad9 some reorder w/ burnettk cullerton
2081532f4 mypy w/ burnettk cullerton
ade7a41e7 added git creds for pushing on publish w/ burnettk cullerton
832d7c5c2 merged in main and resolved conflicts w/ burnettk cullerton
236e0e4ae favor os.path.join over hardcoding slash w/ burnettk
4ce7d6732 pyl passes
b525e3523 added new notification component that allows links based on carbons w/ burnettk cullerton
1e9b2e9ab Return URL where they can view changes and open PR
c8e8dae95 Clone into unique directory so we don't step on a previous publish that hasn't finished.
c5e7e9153 make process metadata saving more resilient
dbaa2c37c added frontend url as post redirect url in keycloak w/ burnettk
348595c19 syntax fix w/ burnettk
bbcfd5213 remove staging py config file in favor of terraform configs w/ burnettk
b150a8a69 moved some configs from deploy scripts to terraform env config w/ burnettk
acf641962 rename terraform configs from rb to py w/ burnettk
862937525 Add comment about the new environment variable
655e01a48 Merge branch 'main' into feature/create_containers
f580cadb2 Merge branch 'main' into feature/git-integration
e241ed5cd updated terraform permissions to match development better w/ burnettk
d102a4c84 Merging this unfinished test so I don't lose it. It doesn't test anything yet. Need to deal w/ a bunch of mock stuff
b5aecb072 Merge pull request #69 from sartography/feature/api_permission_cleanup
a0f351d16 Merge pull request #65 from sartography/new_report
88ad3b99a typing
da082e369 Merge branch 'main' into feature/git-integration
a1fe0193d First pass at git integration
1e029f427 break process instance log list page into two tabs, simple and detailed
11b994a81 Merge remote-tracking branch 'origin/main' into feature/api_permission_cleanup
b1199530d update cors handling to make it more efficient
ed6a4d8c9 more api cleanup w/ burnettk
b19825e17 cleaned up more api routes for permissions w/ burnettk
4b5f5d369 updated tasks endpoint to task-data for easier permission setting w/ burnettk
460cfb4e4 pyl w/ burnettk
85509c3d4 fixing an untyped method.
a7eeaa6d9 running py_pl -- mainly reordering imports.
c9e3e8d31 Merge remote-tracking branch 'origin/main' into feature/create_containers
786785693 Setting things up so it's easy to switch databases using a local configuration file (still works with environment variables) Swtiched from a "joinedload" to a "selectinload" which removes a problem with groupby columns in Postgres and sqlite. (https://docs.sqlalchemy.org/en/14/orm/loading_relationships.html#selectin-eager-loading)
f3760380e added support to order reports by given column and metadata headers w/ burnettk
0425293fd Fixes based off KB's super kind review. ------- * Remove unnecessary packages from dockerfile for the demo-connect proxy. * Rename an environment variable that mentioned Status.im in what is now a generic connector. * Fixed a spelling mistake.
bee4ea107 bump nox stuff and spiff
d7ff963da test for automatic saving of process instance metadata on instance save
fe7c4c923 remove dup test process model
eb2f64518 add order_by to make this query deterministic
9b2a40c87 lint
ceec518c9 add extraction, needs test
9af4cf3f3 fix tests
452c64cbf Merge remote-tracking branch 'origin/main' into new_report
809d8bfbf using an array for metadata extraction paths now instead of dictionaries w/ burnettk
49b02a9c2 added some support to add process model metadata. need to fix frontend w/ burnettk
d2d0cb0b1 getting the collect hit_policy to work correctly.
a3f4c2f48 filtering by metadata works w/ burnettk
f87d266a4 favor report id over identifier but support both and ui updates to allow setting a condition value on a metadata field, changing the display name, and fixes for saving and updating a report
52b288bd4 I can't say I love flake8. Removing dependency on rust (monkeytype)
3534b1896 fixing some typing issues, white space, etal...
389069fde added ability to update the display name for perspective columns w/ burnettk
d9b36f5e1 fixing some typing issues.
51ecd25fb Reorder config imports so that instance config is dead last - and can override everything else. Updated docker-compose for running a demo. run_pyl fixes
d7308ef67 Adding a demo permissions file.
8ade069dd A little cleanup of the ui Don't check authorization on static assets Do not require unique username on user table (uniqueness check is on the service and service id composite.)
1ebe6e108 some updates for process instance reports and metadata w/ burnettk
321fc0e75 Use the "well-known" configuration dictionary from openid to get the url endpoints, rather than trying to configure or guess the correct endpoint urls.
77c79e58b added correlations to message list table w/ burnettk
4df885fd3 Not all open id systems have realms like KeyCloak does -- so removing this in favor of setting just one value - which is the base url of the openid system -- which will work across all openid systems.
d4ad18ab9 Adding a blueprint for openid - a very lightweight embedded authentication system to make it eaiser to try out SpiffWorkflow when you don't have openID set up with Google etal. Removing all calls to open id's user_info endpoint - as these are unncessiary. Adding a users section to the permission files -- so we can handle all user/group/permissions in one file when needed. There was a very confusing is_admin function on the user model that needed killin.
9669f2898 removed file named ':'
341fb8cf5 added api to get list of process report columns
a6002ebac finished base for metadata reporting w/ burnettk
8e9828661 some cleanup for metadata w/ burnettk
91ea7f4b4 metadat reports work w/ burnettk
2571eb656 WIP more metadata reporting w/ burnettk
a2dbee712 WIP more metadata reporting w/ burnettk
a0081bdf7 some basics to add metadata to reports w/ burnettk cullerton
fcc5bce3e fixed issue ensuring active tasks are up to date w/ burnettk cullerton
3ef318e61 added script to save process instance metadata and fixed permissions issue w/ burnettk cullerton
46038eae3 only delete active tasks if needed w/ burnettk cullerton
3b6255147 Merge pull request #64 from sartography/group_query
3abdf8872 get rid of Project Lead group
ded78d9fe Getting ./bin/pyl to pass
c51e56e9b Query fix with the gang
38c37b927 everybody gets access to read processes
e2a3d67eb put sasha and manuchehr in demo group
61a2d858e upgrade keycloak
47b551b8a make sasha, harmeet, manuchehr, and admin have desired permissions for demo
3ecfe6ae4 add demo group access to the customer-contracts to give us 5 tiles for the dmeo.
327981e63 adding the username to the report tables
c90a0a330 Performance improvement in listing all process models.
d32575033 Don't create a processor for every thing all the time.
2f639352a Getting ./bin/pyl to pass
c8f561159 Merge branch 'main' into task_json
fe5f9995b Just save task_json
8f2784828 no global read since that gives configuration as well
e351f033e do not allow starting vendor invoice approval process for demo users
2e97efdbb Change permissions per request -- want everyone to have access to 4 process models.
ff63418ca Change permissions per request -- want everyone to have access to 4 process models.
6b4bcfd34 Merge branch 'main' of github.com:sartography/spiff-arena into main
bc6d80513 Change permissions changed from vendor to core-contributor for everyone.
dfed48057 upgrade keycloak
0f0f56e45 display name instead of id, margin under table sections, Download xml to Download
9af377307 lint
fe5d2fdec exclude instances you started in with_tasks_completed_by_me
bb76eeee5 lint
e30f12fab in completed tab, show display name, and filter by all stopped statuses rather than just complete
57a720c97 tests passing
dc0665c26 gotta fix usage of is_model
63b654c22 working on tests
aa4277d98 oh my god why were these ever instance methods
875bd1576 remove column
6081f6637 renames
aa2333f27 start adding display name and removing garbage
a9d5e121b add fin1, lead1, and Tasks actioned by me to Tasks completed by me
e32c3830b Fix the postgres job (#61)
adcfc53f4 Fix for updating xero token in the background (#60)
bd4f5d247 updated breadcrumb to use display name w/ burnettk
6b94bb260 update permissions per feedback in demo
71c1f7974 rename process_groups_list to process_group_list and fix lint
d4a1d0552 add perm to process instance report list
4f78b1958 some more perm updates for core user w/ burnettk
8fb5fd3c3 Merge branch 'main' of github.com:sartography/spiff-arena
b43a06f51 give core user access to instance tasks w/ burnettk
06ba17be1 Start of system report filters (#57)
213221214 Update oauth redirect url (#58)
75d3c0cea filter process models based on user permissions on the backend if specified w/ burnettk
acc88b9a9 created new users for keycloak and fixed some permissions for core user w/ burnettk cullerton
6eb24f10c Allow switching between user defined reports (#56)
d7cb24a56 fixed broken test
8f9d918ef added recursive option to process model list to recurse or not and fix some ui components
2b47eb7f5 upgrade apscheduler and fix mispelling
2f312e2ab pyl is passing
4fedc046d Merge branch 'main' of https://github.com/sartography/spiff-arena
e6230cb79 pyl is passing w/ burnettk
e5f7f5096 added a script to add a user to a group w/ burnettk
33897da2c mypy
7a9954d74 sort process groups by display name w/ burnettk cullerton
7e9331dd3 Merge branch 'main' into move-group-or-model
d87f47aaa allow getting all process models, process instances should not save when they are initialized, and fixed some cypress tests w/ burnettk
8ffd6203c use correct separator.
de7ebb6f5 Merge branch 'main' of github.com:sartography/spiff-arena into main
bf6645960 Remove MoneyType from dependencies to avoid a new dependency on a rust complier when upgrading to pytno 11.
9455366f5 lint
7866730f2 see if this solves the windows build problem
98e07cc85 add id_for_file_path helper method for process groups
fc476e3cc run_pyl
72da67f00 eliminate security issue by removing py
818bce07e update mysql-connector-python
37444f8bf asst syntax cleanup
7bde5d8cc mypy
ea82bf583 removed print statement and unused line of code
9717fb112 test for move model
d07114593 move model
38dc4570d process group move api endpoint
git-subtree-dir: spiffworkflow-backend
git-subtree-split: ecbe97049cbf46d1d7d240cb80051290de56fa7d
2022-12-10 23:39:01 -05:00
|
|
|
process_instance = ProcessInstanceService.create_process_instance_from_process_model_identifier(
|
2022-11-09 15:02:19 -05:00
|
|
|
# process_group_identifier=process_group_id,
|
|
|
|
process_model_identifier=process_model_identifier,
|
2022-10-12 10:22:22 -04:00
|
|
|
user=user,
|
|
|
|
)
|
|
|
|
processor = ProcessInstanceProcessor(process_instance)
|
|
|
|
processor.slam_in_data(data)
|
|
|
|
process_instance.status = "complete"
|
|
|
|
db.session.add(process_instance)
|
|
|
|
db.session.commit()
|
|
|
|
|
|
|
|
process_instances.append(process_instance)
|
|
|
|
|
|
|
|
return process_instances
|
|
|
|
|
|
|
|
|
|
|
|
def kay() -> dict:
|
|
|
|
"""Kay."""
|
|
|
|
return {"name": "kay", "grade_level": 2, "test_score": 10}
|
|
|
|
|
|
|
|
|
|
|
|
def ray() -> dict:
|
|
|
|
"""Ray."""
|
|
|
|
return {"name": "ray", "grade_level": 1, "test_score": 9}
|
|
|
|
|
|
|
|
|
|
|
|
def jay() -> dict:
|
|
|
|
"""Jay."""
|
|
|
|
return {"name": "jay", "grade_level": 2, "test_score": 8}
|