work in progress
This commit is contained in:
parent
d3e8ac7b9f
commit
93e6adbc23
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:spiffworkflow="http://spiffworkflow.org/bpmn/schema/1.0/core" id="Definitions_96f6665" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.0.0-dev">
|
||||
<bpmn:correlationProperty id="message_correlation_property" name="Message Correlation Property">
|
||||
<bpmn:correlationPropertyRetrievalExpression messageRef="message_send">
|
||||
<bpmn:formalExpression>to</bpmn:formalExpression>
|
||||
</bpmn:correlationPropertyRetrievalExpression>
|
||||
<bpmn:correlationPropertyRetrievalExpression messageRef="message_response">
|
||||
<bpmn:formalExpression>from.name</bpmn:formalExpression>
|
||||
</bpmn:correlationPropertyRetrievalExpression>
|
||||
</bpmn:correlationProperty>
|
||||
<bpmn:message id="message_send" name="Message Send">
|
||||
<bpmn:extensionElements>
|
||||
<spiffworkflow:messagePayload>{"to": "the_recipient1" }</spiffworkflow:messagePayload>
|
||||
</bpmn:extensionElements>
|
||||
</bpmn:message>
|
||||
<bpmn:message id="message_response" name="Message Response">
|
||||
<bpmn:extensionElements>
|
||||
<spiffworkflow:messagePayload>{"from": {"name": "the_sender"}}</spiffworkflow:messagePayload>
|
||||
</bpmn:extensionElements>
|
||||
</bpmn:message>
|
||||
<bpmn:correlationProperty id="correlation_property_one" name="Correlation Property One">
|
||||
<bpmn:correlationPropertyRetrievalExpression messageRef="message_send">
|
||||
<bpmn:formalExpression>new</bpmn:formalExpression>
|
||||
</bpmn:correlationPropertyRetrievalExpression>
|
||||
</bpmn:correlationProperty>
|
||||
<bpmn:process id="test_dot_notation" name="Test Dot Notation" isExecutable="true">
|
||||
<bpmn:startEvent id="start" name="Start">
|
||||
<bpmn:outgoing>Flow_0dbnzbi</bpmn:outgoing>
|
||||
</bpmn:startEvent>
|
||||
<bpmn:sequenceFlow id="Flow_0dbnzbi" sourceRef="start" targetRef="get_data" />
|
||||
<bpmn:endEvent id="end" name="End">
|
||||
<bpmn:incoming>Flow_0nt355i</bpmn:incoming>
|
||||
</bpmn:endEvent>
|
||||
<bpmn:sequenceFlow id="Flow_0nt355i" sourceRef="get_data" targetRef="end" />
|
||||
<bpmn:userTask id="get_data" name="Get Data">
|
||||
<bpmn:extensionElements>
|
||||
<spiffworkflow:properties>
|
||||
<spiffworkflow:property name="formJsonSchemaFilename" value="json_schema.json" />
|
||||
<spiffworkflow:property name="formUiSchemaFilename" value="ui_schema.json" />
|
||||
</spiffworkflow:properties>
|
||||
</bpmn:extensionElements>
|
||||
<bpmn:incoming>Flow_0dbnzbi</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_0nt355i</bpmn:outgoing>
|
||||
</bpmn:userTask>
|
||||
</bpmn:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="test_dotnotation">
|
||||
<bpmndi:BPMNEdge id="Flow_0dbnzbi_di" bpmnElement="Flow_0dbnzbi">
|
||||
<di:waypoint x="208" y="230" />
|
||||
<di:waypoint x="260" y="230" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_0nt355i_di" bpmnElement="Flow_0nt355i">
|
||||
<di:waypoint x="360" y="230" />
|
||||
<di:waypoint x="412" y="230" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNShape id="Event_1uf4njx_di" bpmnElement="start">
|
||||
<dc:Bounds x="172" y="212" width="36" height="36" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="178" y="255" width="24" height="14" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Event_00d0dwr_di" bpmnElement="end">
|
||||
<dc:Bounds x="412" y="212" width="36" height="36" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="420" y="255" width="20" height="14" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_1vgvg3h_di" bpmnElement="get_data">
|
||||
<dc:Bounds x="260" y="190" width="100" height="80" />
|
||||
<bpmndi:BPMNLabel />
|
||||
</bpmndi:BPMNShape>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn:definitions>
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"definitions": {
|
||||
"Color": {
|
||||
"title": "Color",
|
||||
"type": "string",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"#ff0000"
|
||||
],
|
||||
"title": "Red"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"#00ff00"
|
||||
],
|
||||
"title": "Green"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"#0000ff"
|
||||
],
|
||||
"title": "Blue"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"title": "Image editor",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"currentColor"
|
||||
],
|
||||
"properties": {
|
||||
"currentColor": {
|
||||
"$ref": "#/definitions/Color",
|
||||
"title": "Brush color"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
{
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
"""Test Api Blueprint."""
|
||||
# TODO: possibly get this test working again
|
||||
# import json
|
||||
# from typing import Union
|
||||
#
|
||||
# from flask.testing import FlaskClient
|
||||
# from flask_bpmn.models.db import db
|
||||
#
|
||||
# from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
|
||||
#
|
||||
#
|
||||
# def test_user_can_be_created_and_deleted(client: FlaskClient) -> None:
|
||||
# """Test_user_can_be_created_and_deleted."""
|
||||
# process_instance = ProcessInstanceModel.query.filter().first()
|
||||
# if process_instance is not None:
|
||||
# db.session.delete(process_instance)
|
||||
# db.session.commit()
|
||||
#
|
||||
# last_response = None
|
||||
# tasks = [
|
||||
# {"task_identifier": "1", "answer": {"Product Name": "G", "Quantity": "2"}},
|
||||
# {"task_identifier": "1", "answer": {"Sleeve Type": "Short"}},
|
||||
# {"task_identifier": "1", "answer": {"Continue shopping?": "N"}},
|
||||
# {"task_identifier": "1", "answer": {"Shipping Method": "Overnight"}},
|
||||
# {"task_identifier": "1", "answer": {"Shipping Address": "Somewhere"}},
|
||||
# {"task_identifier": "1", "answer": {"Place Order": "Y"}},
|
||||
# {"task_identifier": "1", "answer": {"Card Number": "MY_CARD"}},
|
||||
# {"task_identifier": "2", "answer": {"Was the customer charged?": "Y"}},
|
||||
# {"task_identifier": "1", "answer": {"Was the product available?": "Y"}},
|
||||
# {"task_identifier": "1", "answer": {"Was the order shipped?": "Y"}},
|
||||
# ]
|
||||
# for task in tasks:
|
||||
# run_task(client, task, last_response)
|
||||
#
|
||||
# process_instance = ProcessInstanceModel.query.filter().first()
|
||||
# if process_instance is not None:
|
||||
# db.session.delete(process_instance)
|
||||
# db.session.commit()
|
||||
#
|
||||
#
|
||||
# def run_task(
|
||||
# client: FlaskClient, request_body: dict, last_response: Union[None, str]
|
||||
# ) -> None:
|
||||
# """Run_task."""
|
||||
# response = client.post(
|
||||
# "/run_process",
|
||||
# content_type="application/json",
|
||||
# data=json.dumps(request_body),
|
||||
# )
|
||||
# assert response.status_code == 200
|
|
@ -14,6 +14,7 @@ from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
|
|||
from spiffworkflow_backend.exceptions.process_entity_not_found_error import (
|
||||
ProcessEntityNotFoundError,
|
||||
)
|
||||
from spiffworkflow_backend.models.active_task import ActiveTaskModel
|
||||
from spiffworkflow_backend.models.process_group import ProcessGroup
|
||||
from spiffworkflow_backend.models.process_group import ProcessGroupSchema
|
||||
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
|
||||
|
@ -956,6 +957,42 @@ class TestProcessApi(BaseTest):
|
|||
assert task_event.user_id == user.id
|
||||
# TODO: When user tasks work, we need to add some more assertions for action, task_state, etc.
|
||||
|
||||
def test_task_show(
|
||||
self, app: Flask, client: FlaskClient, with_db_and_bpmn_file_cleanup: None
|
||||
) -> None:
|
||||
"""Test_process_instance_run_user_task."""
|
||||
process_group_id = "my_process_group"
|
||||
process_model_id = "dynamic_enum_select_fields"
|
||||
|
||||
user = self.find_or_create_user()
|
||||
headers = self.logged_in_headers(user)
|
||||
response = self.create_process_instance(
|
||||
client, process_group_id, process_model_id, headers
|
||||
)
|
||||
assert response.json is not None
|
||||
process_instance_id = response.json["id"]
|
||||
|
||||
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),
|
||||
)
|
||||
|
||||
assert response.json is not None
|
||||
active_tasks = (
|
||||
db.session.query(ActiveTaskModel)
|
||||
.filter(ActiveTaskModel.process_instance_id == process_instance_id)
|
||||
.all()
|
||||
)
|
||||
assert len(active_tasks) == 1
|
||||
active_task = active_tasks[0]
|
||||
print(f"active_task.task_id: {active_task.task_id}")
|
||||
response = client.get(
|
||||
f"/v1.0/tasks/{process_instance_id}/{active_task.task_id}",
|
||||
headers=self.logged_in_headers(user),
|
||||
)
|
||||
assert response.json is not None
|
||||
print(f"response.json: {response.json}")
|
||||
|
||||
def test_process_instance_list_with_default_list(
|
||||
self, app: Flask, client: FlaskClient, with_db_and_bpmn_file_cleanup: None
|
||||
) -> None:
|
||||
|
|
Loading…
Reference in New Issue