add test for filtering columns and clarify that we are doing unit tests with api, whoops

This commit is contained in:
burnettk 2023-03-24 18:11:11 -04:00
parent 54927ef62c
commit a263696758
16 changed files with 111 additions and 59 deletions

View File

@ -78,7 +78,7 @@ class BaseTest:
if bpmn_file_location is None: if bpmn_file_location is None:
bpmn_file_location = process_model_id bpmn_file_location = process_model_id
self.create_process_group(client, user, process_group_description, process_group_display_name) self.create_process_group_with_api(client, user, process_group_description, process_group_display_name)
self.create_process_model_with_api( self.create_process_model_with_api(
client, client,
@ -97,6 +97,15 @@ class BaseTest:
return process_model_identifier return process_model_identifier
def create_process_group( def create_process_group(
self,
process_group_id: str,
display_name: str = "",
) -> ProcessGroup:
"""Create_process_group."""
process_group = ProcessGroup(id=process_group_id, display_name=display_name, display_order=0, admin=False)
return ProcessModelService.add_process_group(process_group)
def create_process_group_with_api(
self, self,
client: FlaskClient, client: FlaskClient,
user: Any, user: Any,
@ -353,3 +362,20 @@ class BaseTest:
def un_modify_modified_process_identifier_for_path_param(self, modified_identifier: str) -> str: def un_modify_modified_process_identifier_for_path_param(self, modified_identifier: str) -> str:
"""Un_modify_modified_process_model_id.""" """Un_modify_modified_process_model_id."""
return modified_identifier.replace(":", "/") return modified_identifier.replace(":", "/")
def create_process_model_with_metadata(self) -> ProcessModelInfo:
self.create_process_group("test_group", "test_group")
process_model = load_test_spec(
"test_group/hello_world",
process_model_source_directory="nested-task-data-structure",
)
ProcessModelService.update_process_model(
process_model,
{
"metadata_extraction_paths": [
{"key": "awesome_var", "path": "outer.inner"},
{"key": "invoice_number", "path": "invoice_number"},
]
},
)
return process_model

View File

@ -25,7 +25,7 @@ class TestLoggingService(BaseTest):
with_db_and_bpmn_file_cleanup: None, with_db_and_bpmn_file_cleanup: None,
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
initiator_user = self.find_or_create_user("initiator_user") initiator_user = self.find_or_create_user("initiator_user")
assert initiator_user.principal is not None assert initiator_user.principal is not None
AuthorizationService.import_permissions_from_yaml_file() AuthorizationService.import_permissions_from_yaml_file()
@ -85,7 +85,7 @@ class TestLoggingService(BaseTest):
with_db_and_bpmn_file_cleanup: None, with_db_and_bpmn_file_cleanup: None,
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
initiator_user = self.find_or_create_user("initiator_user") initiator_user = self.find_or_create_user("initiator_user")
assert initiator_user.principal is not None assert initiator_user.principal is not None
AuthorizationService.import_permissions_from_yaml_file() AuthorizationService.import_permissions_from_yaml_file()

View File

@ -118,7 +118,7 @@ class TestProcessApi(BaseTest):
process_group_id = "test_process_group" process_group_id = "test_process_group"
process_group_display_name = "Test Process Group" process_group_display_name = "Test Process Group"
# creates the group directory, and the json file # creates the group directory, and the json file
self.create_process_group(client, with_super_admin_user, process_group_id, process_group_display_name) self.create_process_group_with_api(client, with_super_admin_user, process_group_id, process_group_display_name)
process_model_id = "sample" process_model_id = "sample"
model_display_name = "Sample" model_display_name = "Sample"
@ -169,7 +169,7 @@ class TestProcessApi(BaseTest):
process_group_description = "Test Process Group" process_group_description = "Test Process Group"
process_model_id = "sample" process_model_id = "sample"
process_model_identifier = f"{process_group_id}/{process_model_id}" process_model_identifier = f"{process_group_id}/{process_model_id}"
self.create_process_group(client, with_super_admin_user, process_group_id, process_group_description) self.create_process_group_with_api(client, with_super_admin_user, process_group_id, process_group_description)
text = "Create a Bug Tracker process model " text = "Create a Bug Tracker process model "
text += "with a Bug Details form that collects summary, description, and priority" text += "with a Bug Details form that collects summary, description, and priority"
@ -237,7 +237,9 @@ class TestProcessApi(BaseTest):
process_model_identifier = f"{process_group_id}/{process_model_id}" process_model_identifier = f"{process_group_id}/{process_model_id}"
initial_primary_process_id = "sample" initial_primary_process_id = "sample"
terminal_primary_process_id = "new_process_id" terminal_primary_process_id = "new_process_id"
self.create_process_group(client=client, user=with_super_admin_user, process_group_id=process_group_id) self.create_process_group_with_api(
client=client, user=with_super_admin_user, process_group_id=process_group_id
)
bpmn_file_name = f"{process_model_id}.bpmn" bpmn_file_name = f"{process_model_id}.bpmn"
bpmn_file_source_directory = process_model_id bpmn_file_source_directory = process_model_id
@ -281,7 +283,7 @@ class TestProcessApi(BaseTest):
process_group_description = "Test Process Group" process_group_description = "Test Process Group"
process_model_id = "sample" process_model_id = "sample"
process_model_identifier = f"{process_group_id}/{process_model_id}" process_model_identifier = f"{process_group_id}/{process_model_id}"
self.create_process_group(client, with_super_admin_user, process_group_id, process_group_description) self.create_process_group_with_api(client, with_super_admin_user, process_group_id, process_group_description)
self.create_process_model_with_api( self.create_process_model_with_api(
client, client,
process_model_id=process_model_identifier, process_model_id=process_model_identifier,
@ -317,7 +319,7 @@ class TestProcessApi(BaseTest):
bpmn_file_location = "sample" bpmn_file_location = "sample"
process_model_identifier = f"{test_process_group_id}/{test_process_model_id}" process_model_identifier = f"{test_process_group_id}/{test_process_model_id}"
modified_process_model_identifier = process_model_identifier.replace("/", ":") modified_process_model_identifier = process_model_identifier.replace("/", ":")
self.create_process_group(client, with_super_admin_user, test_process_group_id) self.create_process_group_with_api(client, with_super_admin_user, test_process_group_id)
self.create_process_model_with_api(client, process_model_identifier, user=with_super_admin_user) self.create_process_model_with_api(client, process_model_identifier, user=with_super_admin_user)
bpmn_file_data_bytes = self.get_test_data_file_contents(bpmn_file_name, bpmn_file_location) bpmn_file_data_bytes = self.get_test_data_file_contents(bpmn_file_name, bpmn_file_location)
self.create_spec_file( self.create_spec_file(
@ -362,7 +364,7 @@ class TestProcessApi(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_process_model_update.""" """Test_process_model_update."""
self.create_process_group(client, with_super_admin_user, "test_process_group", "Test Process Group") self.create_process_group_with_api(client, with_super_admin_user, "test_process_group", "Test Process Group")
process_model_identifier = "test_process_group/make_cookies" process_model_identifier = "test_process_group/make_cookies"
self.create_process_model_with_api( self.create_process_model_with_api(
client, client,
@ -403,7 +405,7 @@ class TestProcessApi(BaseTest):
) -> None: ) -> None:
"""Test_process_model_list_all.""" """Test_process_model_list_all."""
group_id = "test_group/test_sub_group" group_id = "test_group/test_sub_group"
self.create_process_group(client, with_super_admin_user, group_id) self.create_process_group_with_api(client, with_super_admin_user, group_id)
# add 5 models to the group # add 5 models to the group
for i in range(5): for i in range(5):
@ -439,7 +441,7 @@ class TestProcessApi(BaseTest):
"""Test_process_model_list.""" """Test_process_model_list."""
# create a group # create a group
group_id = "test_group" group_id = "test_group"
self.create_process_group(client, with_super_admin_user, group_id) self.create_process_group_with_api(client, with_super_admin_user, group_id)
# add 5 models to the group # add 5 models to the group
for i in range(5): for i in range(5):
@ -603,7 +605,7 @@ class TestProcessApi(BaseTest):
process_group_id = "test" process_group_id = "test"
process_group_display_name = "My Process Group" process_group_display_name = "My Process Group"
self.create_process_group( self.create_process_group_with_api(
client, client,
with_super_admin_user, with_super_admin_user,
process_group_id, process_group_id,
@ -632,7 +634,7 @@ class TestProcessApi(BaseTest):
group_id = "test_process_group" group_id = "test_process_group"
group_display_name = "Test Group" group_display_name = "Test Group"
self.create_process_group(client, with_super_admin_user, group_id, display_name=group_display_name) self.create_process_group_with_api(client, with_super_admin_user, group_id, display_name=group_display_name)
process_group = ProcessModelService.get_process_group(group_id) process_group = ProcessModelService.get_process_group(group_id)
assert process_group.display_name == group_display_name assert process_group.display_name == group_display_name
@ -662,7 +664,9 @@ class TestProcessApi(BaseTest):
for i in range(5): for i in range(5):
group_id = f"test_process_group_{i}" group_id = f"test_process_group_{i}"
group_display_name = f"Test Group {i}" group_display_name = f"Test Group {i}"
self.create_process_group(client, with_super_admin_user, group_id, display_name=group_display_name) self.create_process_group_with_api(
client, with_super_admin_user, group_id, display_name=group_display_name
)
# get all groups # get all groups
response = client.get( response = client.get(
@ -787,7 +791,7 @@ class TestProcessApi(BaseTest):
process_group_description = "Test Group" process_group_description = "Test Group"
process_model_id = "random_fact" process_model_id = "random_fact"
process_model_identifier = f"{process_group_id}/{process_model_id}" process_model_identifier = f"{process_group_id}/{process_model_id}"
self.create_process_group(client, with_super_admin_user, process_group_id, process_group_description) self.create_process_group_with_api(client, with_super_admin_user, process_group_id, process_group_description)
self.create_process_model_with_api( self.create_process_model_with_api(
client, client,
process_model_id=process_model_identifier, process_model_id=process_model_identifier,
@ -1091,7 +1095,7 @@ class TestProcessApi(BaseTest):
) -> None: ) -> None:
"""Test_get_process_model_when_not_found.""" """Test_get_process_model_when_not_found."""
process_model_dir_name = "THIS_NO_EXISTS" process_model_dir_name = "THIS_NO_EXISTS"
group_id = self.create_process_group(client, with_super_admin_user, "my_group") group_id = self.create_process_group_with_api(client, with_super_admin_user, "my_group")
bad_process_model_id = f"{group_id}/{process_model_dir_name}" bad_process_model_id = f"{group_id}/{process_model_dir_name}"
modified_bad_process_model_id = bad_process_model_id.replace("/", ":") modified_bad_process_model_id = bad_process_model_id.replace("/", ":")
response = client.get( response = client.get(
@ -2714,7 +2718,7 @@ class TestProcessApi(BaseTest):
groups = ["group_a", "group_b", "group_b/group_bb"] groups = ["group_a", "group_b", "group_b/group_bb"]
# setup initial groups # setup initial groups
for group in groups: for group in groups:
self.create_process_group(client, with_super_admin_user, group, display_name=group) self.create_process_group_with_api(client, with_super_admin_user, group, display_name=group)
# make sure initial groups exist # make sure initial groups exist
for group in groups: for group in groups:
persisted = ProcessModelService.get_process_group(group) persisted = ProcessModelService.get_process_group(group)
@ -2783,7 +2787,7 @@ class TestProcessApi(BaseTest):
sub_group_id = "sub_group" sub_group_id = "sub_group"
original_location = "group_a" original_location = "group_a"
original_sub_path = f"{original_location}/{sub_group_id}" original_sub_path = f"{original_location}/{sub_group_id}"
self.create_process_group(client, with_super_admin_user, original_sub_path, display_name=sub_group_id) self.create_process_group_with_api(client, with_super_admin_user, original_sub_path, display_name=sub_group_id)
# make sure original subgroup exists # make sure original subgroup exists
persisted = ProcessModelService.get_process_group(original_sub_path) persisted = ProcessModelService.get_process_group(original_sub_path)
assert persisted is not None assert persisted is not None
@ -2835,7 +2839,7 @@ class TestProcessApi(BaseTest):
# ) # )
# #
# process_group_id = "test_group" # process_group_id = "test_group"
# self.create_process_group( # self.create_process_group_with_api(
# client, with_super_admin_user, process_group_id, process_group_id # client, with_super_admin_user, process_group_id, process_group_id
# ) # )
# #
@ -3077,6 +3081,18 @@ class TestProcessApi(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_can_get_process_instance_list_with_report_metadata.""" """Test_can_get_process_instance_list_with_report_metadata."""
process_model = self.create_process_model_with_metadata()
process_instance = self.create_process_instance_from_process_model(
process_model=process_model, user=with_super_admin_user
)
processor = ProcessInstanceProcessor(process_instance)
processor.do_engine_steps(save=True)
process_instance_metadata = ProcessInstanceMetadataModel.query.filter_by(
process_instance_id=process_instance.id
).all()
assert len(process_instance_metadata) == 2
process_model = load_test_spec( process_model = load_test_spec(
process_model_id="save_process_instance_metadata/save_process_instance_metadata", process_model_id="save_process_instance_metadata/save_process_instance_metadata",
bpmn_file_name="save_process_instance_metadata.bpmn", bpmn_file_name="save_process_instance_metadata.bpmn",
@ -3115,11 +3131,35 @@ class TestProcessApi(BaseTest):
"filterable": False, "filterable": False,
}, },
{"Header": "Status", "accessor": "status", "filterable": False}, {"Header": "Status", "accessor": "status", "filterable": False},
{"Header": "awesome_var", "accessor": "awesome_var", "filterable": True},
{"Header": "invoice_number", "accessor": "invoice_number", "filterable": True},
{"Header": "key1", "accessor": "key1", "filterable": True}, {"Header": "key1", "accessor": "key1", "filterable": True},
{"Header": "key2", "accessor": "key2", "filterable": True}, {"Header": "key2", "accessor": "key2", "filterable": True},
{"Header": "key3", "accessor": "key3", "filterable": True}, {"Header": "key3", "accessor": "key3", "filterable": True},
] ]
# pluck accessor from each dict in list
accessors = [column["accessor"] for column in response.json]
stock_columns = [
"id",
"process_model_display_name",
"start_in_seconds",
"end_in_seconds",
"process_initiator_username",
"status",
]
assert accessors == stock_columns + ["awesome_var", "invoice_number", "key1", "key2", "key3"]
# expected columns are fewer if we filter by process_model_identifier
response = client.get(
"/v1.0/process-instances/reports/columns?process_model_identifier=save_process_instance_metadata/save_process_instance_metadata",
headers=self.logged_in_headers(with_super_admin_user),
)
assert response.json is not None
assert response.status_code == 200
accessors = [column["accessor"] for column in response.json]
assert accessors == stock_columns + ["key1", "key2", "key3"]
def test_process_instance_list_can_order_by_metadata( def test_process_instance_list_can_order_by_metadata(
self, self,
app: Flask, app: Flask,
@ -3128,7 +3168,7 @@ class TestProcessApi(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_process_instance_list_can_order_by_metadata.""" """Test_process_instance_list_can_order_by_metadata."""
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
process_model = load_test_spec( process_model = load_test_spec(
"test_group/hello_world", "test_group/hello_world",
process_model_source_directory="nested-task-data-structure", process_model_source_directory="nested-task-data-structure",

View File

@ -34,7 +34,7 @@ class SecretServiceTestHelpers(BaseTest):
def add_test_process(self, client: FlaskClient, user: UserModel) -> ProcessModelInfo: def add_test_process(self, client: FlaskClient, user: UserModel) -> ProcessModelInfo:
"""Add_test_process.""" """Add_test_process."""
self.create_process_group( self.create_process_group_with_api(
client, client,
user, user,
self.test_process_group_id, self.test_process_group_id,

View File

@ -38,7 +38,7 @@ class TestGetGroupMembers(BaseTest):
UserService.add_user_to_group(testuser2, group_a) UserService.add_user_to_group(testuser2, group_a)
UserService.add_user_to_group(testuser3, group_b) UserService.add_user_to_group(testuser3, group_b)
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
process_model = load_test_spec( process_model = load_test_spec(
process_model_id="test_group/get_group_members", process_model_id="test_group/get_group_members",
bpmn_file_name="get_group_members.bpmn", bpmn_file_name="get_group_members.bpmn",

View File

@ -23,7 +23,7 @@ class TestGetLastUserCompletingTask(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_sets_permission_correctly_on_human_task.""" """Test_sets_permission_correctly_on_human_task."""
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
initiator_user = self.find_or_create_user("initiator_user") initiator_user = self.find_or_create_user("initiator_user")
assert initiator_user.principal is not None assert initiator_user.principal is not None
AuthorizationService.import_permissions_from_yaml_file() AuthorizationService.import_permissions_from_yaml_file()

View File

@ -54,7 +54,7 @@ class TestGetLocaltime(BaseTest):
target_uri="/v1.0/process-groups", target_uri="/v1.0/process-groups",
permission_names=["read", "create"], permission_names=["read", "create"],
) )
self.create_process_group(client=client, user=initiator_user, process_group_id="test_group") self.create_process_group_with_api(client=client, user=initiator_user, process_group_id="test_group")
process_model = load_test_spec( process_model = load_test_spec(
process_model_id="test_group/get_localtime", process_model_id="test_group/get_localtime",
bpmn_file_name="get_localtime.bpmn", bpmn_file_name="get_localtime.bpmn",

View File

@ -23,7 +23,7 @@ class TestGetProcessInitiatorUser(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_sets_permission_correctly_on_human_task.""" """Test_sets_permission_correctly_on_human_task."""
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
initiator_user = self.find_or_create_user("initiator_user") initiator_user = self.find_or_create_user("initiator_user")
assert initiator_user.principal is not None assert initiator_user.principal is not None
AuthorizationService.import_permissions_from_yaml_file() AuthorizationService.import_permissions_from_yaml_file()

View File

@ -24,7 +24,7 @@ class TestSaveProcessInstanceMetadata(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_can_save_process_instance_metadata.""" """Test_can_save_process_instance_metadata."""
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
process_model = load_test_spec( process_model = load_test_spec(
process_model_id="save_process_instance_metadata/save_process_instance_metadata", process_model_id="save_process_instance_metadata/save_process_instance_metadata",
bpmn_file_name="save_process_instance_metadata.bpmn", bpmn_file_name="save_process_instance_metadata.bpmn",

View File

@ -153,7 +153,7 @@ class TestMessageService(BaseTest):
group_name: str = "test_group", group_name: str = "test_group",
) -> None: ) -> None:
process_group_id = group_name process_group_id = group_name
self.create_process_group(client, with_super_admin_user, process_group_id, process_group_id) self.create_process_group_with_api(client, with_super_admin_user, process_group_id, process_group_id)
process_model = load_test_spec( process_model = load_test_spec(
"test_group/message", "test_group/message",
@ -222,7 +222,7 @@ class TestMessageService(BaseTest):
) -> None: ) -> None:
"""Test_can_send_message_to_multiple_process_models.""" """Test_can_send_message_to_multiple_process_models."""
process_group_id = "test_group_multi" process_group_id = "test_group_multi"
self.create_process_group(client, with_super_admin_user, process_group_id, process_group_id) self.create_process_group_with_api(client, with_super_admin_user, process_group_id, process_group_id)
process_model_sender = load_test_spec( process_model_sender = load_test_spec(
"test_group/message_sender", "test_group/message_sender",

View File

@ -33,7 +33,7 @@ class TestPermissions(BaseTest):
) -> None: ) -> None:
"""Test_user_can_be_given_permission_to_administer_process_group.""" """Test_user_can_be_given_permission_to_administer_process_group."""
process_group_id = "group-a" process_group_id = "group-a"
self.create_process_group(client, with_super_admin_user, process_group_id, process_group_id) self.create_process_group_with_api(client, with_super_admin_user, process_group_id, process_group_id)
load_test_spec( load_test_spec(
"group-a/timers_intermediate_catch_event", "group-a/timers_intermediate_catch_event",
bpmn_file_name="timers_intermediate_catch_event.bpmn", bpmn_file_name="timers_intermediate_catch_event.bpmn",

View File

@ -72,7 +72,7 @@ class TestProcessInstanceProcessor(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_sets_permission_correctly_on_human_task.""" """Test_sets_permission_correctly_on_human_task."""
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
initiator_user = self.find_or_create_user("initiator_user") initiator_user = self.find_or_create_user("initiator_user")
finance_user = self.find_or_create_user("testuser2") finance_user = self.find_or_create_user("testuser2")
assert initiator_user.principal is not None assert initiator_user.principal is not None
@ -140,7 +140,7 @@ class TestProcessInstanceProcessor(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_sets_permission_correctly_on_human_task_when_using_dict.""" """Test_sets_permission_correctly_on_human_task_when_using_dict."""
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
initiator_user = self.find_or_create_user("initiator_user") initiator_user = self.find_or_create_user("initiator_user")
finance_user_three = self.find_or_create_user("testuser3") finance_user_three = self.find_or_create_user("testuser3")
finance_user_four = self.find_or_create_user("testuser4") finance_user_four = self.find_or_create_user("testuser4")
@ -264,7 +264,7 @@ class TestProcessInstanceProcessor(BaseTest):
# with_db_and_bpmn_file_cleanup: None, # with_db_and_bpmn_file_cleanup: None,
# with_super_admin_user: UserModel, # with_super_admin_user: UserModel,
# ) -> None: # ) -> None:
# self.create_process_group(client, with_super_admin_user, "test_group", "test_group") # self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
# initiator_user = self.find_or_create_user("initiator_user") # initiator_user = self.find_or_create_user("initiator_user")
# finance_user_three = self.find_or_create_user("testuser3") # finance_user_three = self.find_or_create_user("testuser3")
# assert initiator_user.principal is not None # assert initiator_user.principal is not None
@ -318,7 +318,7 @@ class TestProcessInstanceProcessor(BaseTest):
with_db_and_bpmn_file_cleanup: None, with_db_and_bpmn_file_cleanup: None,
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
initiator_user = self.find_or_create_user("initiator_user") initiator_user = self.find_or_create_user("initiator_user")
finance_user_three = self.find_or_create_user("testuser3") finance_user_three = self.find_or_create_user("testuser3")
assert initiator_user.principal is not None assert initiator_user.principal is not None
@ -472,7 +472,7 @@ class TestProcessInstanceProcessor(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_does_not_recreate_human_tasks_on_multiple_saves.""" """Test_does_not_recreate_human_tasks_on_multiple_saves."""
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
initiator_user = self.find_or_create_user("initiator_user") initiator_user = self.find_or_create_user("initiator_user")
finance_user_three = self.find_or_create_user("testuser3") finance_user_three = self.find_or_create_user("testuser3")
assert initiator_user.principal is not None assert initiator_user.principal is not None

View File

@ -14,7 +14,6 @@ from spiffworkflow_backend.models.user import UserModel
from spiffworkflow_backend.services.process_instance_processor import ( from spiffworkflow_backend.services.process_instance_processor import (
ProcessInstanceProcessor, ProcessInstanceProcessor,
) )
from spiffworkflow_backend.services.process_model_service import ProcessModelService
class TestProcessModel(BaseTest): class TestProcessModel(BaseTest):
@ -33,7 +32,7 @@ class TestProcessModel(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_can_run_process_model_with_call_activities.""" """Test_can_run_process_model_with_call_activities."""
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
process_model = load_test_spec( process_model = load_test_spec(
"test_group/call_activity_test", "test_group/call_activity_test",
# bpmn_file_name="call_activity_test.bpmn", # bpmn_file_name="call_activity_test.bpmn",
@ -53,7 +52,7 @@ class TestProcessModel(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_can_run_process_model_with_call_activities.""" """Test_can_run_process_model_with_call_activities."""
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
process_model = load_test_spec( process_model = load_test_spec(
"test_group/call_activity_nested", "test_group/call_activity_nested",
process_model_source_directory="call_activity_nested", process_model_source_directory="call_activity_nested",
@ -84,7 +83,7 @@ class TestProcessModel(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_can_run_process_model_with_call_activities.""" """Test_can_run_process_model_with_call_activities."""
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
process_model = load_test_spec( process_model = load_test_spec(
"test_group/call_activity_nested", "test_group/call_activity_nested",
process_model_source_directory="call_activity_nested", process_model_source_directory="call_activity_nested",
@ -120,20 +119,7 @@ class TestProcessModel(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_can_run_process_model_with_call_activities.""" """Test_can_run_process_model_with_call_activities."""
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") process_model = self.create_process_model_with_metadata()
process_model = load_test_spec(
"test_group/hello_world",
process_model_source_directory="nested-task-data-structure",
)
ProcessModelService.update_process_model(
process_model,
{
"metadata_extraction_paths": [
{"key": "awesome_var", "path": "outer.inner"},
{"key": "invoice_number", "path": "invoice_number"},
]
},
)
process_instance = self.create_process_instance_from_process_model(process_model) process_instance = self.create_process_instance_from_process_model(process_model)
processor = ProcessInstanceProcessor(process_instance) processor = ProcessInstanceProcessor(process_instance)

View File

@ -19,7 +19,7 @@ class TestProcessModelService(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_can_update_specified_attributes.""" """Test_can_update_specified_attributes."""
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
process_model = load_test_spec( process_model = load_test_spec(
"test_group/hello_world", "test_group/hello_world",
bpmn_file_name="hello_world.bpmn", bpmn_file_name="hello_world.bpmn",

View File

@ -23,7 +23,7 @@ class TestOpenFile(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_form_data_conversion_to_dot_dict.""" """Test_form_data_conversion_to_dot_dict."""
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
process_model = load_test_spec( process_model = load_test_spec(
"test_group/dangerous", "test_group/dangerous",
bpmn_file_name="read_etc_passwd.bpmn", bpmn_file_name="read_etc_passwd.bpmn",
@ -50,7 +50,7 @@ class TestImportModule(BaseTest):
with_super_admin_user: UserModel, with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_form_data_conversion_to_dot_dict.""" """Test_form_data_conversion_to_dot_dict."""
self.create_process_group(client, with_super_admin_user, "test_group", "test_group") self.create_process_group_with_api(client, with_super_admin_user, "test_group", "test_group")
process_model = load_test_spec( process_model = load_test_spec(
"test_group/dangerous", "test_group/dangerous",
bpmn_file_name="read_env.bpmn", bpmn_file_name="read_env.bpmn",

View File

@ -26,7 +26,7 @@ class TestScriptUnitTestRunner(BaseTest):
app.config["THREAD_LOCAL_DATA"].process_instance_id = None app.config["THREAD_LOCAL_DATA"].process_instance_id = None
process_group_id = "test_logging_spiff_logger" process_group_id = "test_logging_spiff_logger"
self.create_process_group(client, with_super_admin_user, process_group_id, process_group_id) self.create_process_group_with_api(client, with_super_admin_user, process_group_id, process_group_id)
process_model_id = "simple_script" process_model_id = "simple_script"
process_model_identifier = f"{process_group_id}/{process_model_id}" process_model_identifier = f"{process_group_id}/{process_model_id}"
load_test_spec( load_test_spec(
@ -62,7 +62,7 @@ class TestScriptUnitTestRunner(BaseTest):
app.config["THREAD_LOCAL_DATA"].process_instance_id = None app.config["THREAD_LOCAL_DATA"].process_instance_id = None
process_group_id = "test_logging_spiff_logger" process_group_id = "test_logging_spiff_logger"
self.create_process_group(client, with_super_admin_user, process_group_id, process_group_id) self.create_process_group_with_api(client, with_super_admin_user, process_group_id, process_group_id)
process_model_id = "simple_script" process_model_id = "simple_script"
process_model_identifier = f"{process_group_id}/{process_model_id}" process_model_identifier = f"{process_group_id}/{process_model_id}"
@ -99,7 +99,7 @@ class TestScriptUnitTestRunner(BaseTest):
app.config["THREAD_LOCAL_DATA"].process_instance_id = None app.config["THREAD_LOCAL_DATA"].process_instance_id = None
process_group_id = "script_with_unit_tests" process_group_id = "script_with_unit_tests"
self.create_process_group(client, with_super_admin_user, process_group_id, process_group_id) self.create_process_group_with_api(client, with_super_admin_user, process_group_id, process_group_id)
process_model_id = "script_with_unit_tests" process_model_id = "script_with_unit_tests"
process_model_identifier = f"{process_group_id}/{process_model_id}" process_model_identifier = f"{process_group_id}/{process_model_id}"
@ -132,7 +132,7 @@ class TestScriptUnitTestRunner(BaseTest):
app.config["THREAD_LOCAL_DATA"].process_instance_id = None app.config["THREAD_LOCAL_DATA"].process_instance_id = None
process_group_id = "script_with_unit_tests" process_group_id = "script_with_unit_tests"
self.create_process_group(client, with_super_admin_user, process_group_id, process_group_id) self.create_process_group_with_api(client, with_super_admin_user, process_group_id, process_group_id)
process_model_id = "script_with_unit_tests" process_model_id = "script_with_unit_tests"
process_model_identifier = f"{process_group_id}/{process_model_id}" process_model_identifier = f"{process_group_id}/{process_model_id}"