add test for process_instance_show
This commit is contained in:
parent
78e428feaa
commit
a87a49ae0f
|
@ -625,9 +625,6 @@ def process_instance_show(
|
|||
bpmn_xml_file_contents = GitService.get_instance_file_contents_for_revision(
|
||||
process_model, process_instance.bpmn_version_control_identifier
|
||||
)
|
||||
# dummy_var = GitService.get_instance_file_contents_for_revision(
|
||||
# process_model, process_instance.bpmn_version_control_identifier
|
||||
# )
|
||||
process_instance.bpmn_xml_file_contents = bpmn_xml_file_contents
|
||||
|
||||
return make_response(jsonify(process_instance), 200)
|
||||
|
|
|
@ -8,6 +8,8 @@ import pytest
|
|||
from flask.app import Flask
|
||||
from flask.testing import FlaskClient
|
||||
from flask_bpmn.models.db import db
|
||||
|
||||
from spiffworkflow_backend.services.file_system_service import FileSystemService
|
||||
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
|
||||
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
|
||||
|
||||
|
@ -722,6 +724,29 @@ class TestProcessApi(BaseTest):
|
|||
assert response.json["data"]["Mike"] == "Awesome"
|
||||
assert response.json["data"]["person"] == "Kevin"
|
||||
|
||||
def test_process_instance_show(self, app: Flask, client: FlaskClient, with_db_and_bpmn_file_cleanup: None) -> None:
|
||||
process_group_id = "simple_script"
|
||||
process_model_id = "simple_script"
|
||||
user = self.find_or_create_user()
|
||||
headers = self.logged_in_headers(user)
|
||||
create_response = self.create_process_instance(
|
||||
client, process_group_id, process_model_id, headers
|
||||
)
|
||||
process_instance_id = create_response.json["id"]
|
||||
run_response = client.post(
|
||||
f"/v1.0/process-models/{process_group_id}/{process_model_id}/process-instances/{process_instance_id}/run",
|
||||
headers=self.logged_in_headers(user),
|
||||
)
|
||||
show_response = client.get(
|
||||
f"/v1.0/process-models/{process_group_id}/{process_model_id}/process-instances/{process_instance_id}",
|
||||
headers=self.logged_in_headers(user)
|
||||
)
|
||||
file_system_root = FileSystemService.root_path()
|
||||
file_path = f"{file_system_root}/{process_group_id}/{process_model_id}/{process_model_id}.bpmn"
|
||||
with open(file_path) as f_open:
|
||||
xml_file_contents = f_open.read()
|
||||
assert show_response.json['bpmn_xml_file_contents'] == xml_file_contents
|
||||
|
||||
def test_message_start_when_starting_process_instance(
|
||||
self, app: Flask, client: FlaskClient, with_db_and_bpmn_file_cleanup: None
|
||||
) -> None:
|
||||
|
|
Loading…
Reference in New Issue