added api to get a single process group w/ burnettk

This commit is contained in:
jasquat 2022-06-03 12:18:41 -04:00
parent 725b06d084
commit 7b3f3410d7
4 changed files with 35 additions and 1 deletions

View File

@ -25,6 +25,19 @@ paths:
type: array
items:
$ref: "#/components/schemas/WorkflowSpecCategory"
/process-group/{process_group_id}:
get:
operationId: spiffworkflow_backend.routes.process_api_blueprint.process_group_show
summary: Returns a single process group
tags:
- Workflow Specification Category
responses:
'200':
description: Workflow spec category.
content:
application/json:
schema:
$ref: "#/components/schemas/WorkflowSpecCategory"
/workflow-specification:
# get:
# operationId: crc.api.workflow.all_specifications

View File

@ -87,3 +87,9 @@ def process_groups_list():
process_model_service = ProcessModelService()
process_groups = process_model_service.get_process_groups()
return ProcessGroupSchema(many=True).dump(process_groups)
def process_group_show(process_group_id):
"""Process_group_show."""
process_group = ProcessModelService().get_process_group(process_group_id)
return ProcessGroupSchema().dump(process_group)

View File

@ -37,8 +37,11 @@ def assure_process_group_exists(process_group_id=None):
if process_group_id is not None:
process_group = workflow_spec_service.get_process_group(process_group_id)
if process_group is None:
process_group_id_to_create = "test_process_group"
if process_group_id is not None:
process_group_id_to_create = process_group_id
process_group = ProcessGroup(
id="test_process_group",
id=process_group_id_to_create,
display_name="Test Workflows",
admin=False,
display_order=0,
@ -58,6 +61,8 @@ def load_test_spec(
"""Loads a spec into the database based on a directory in /tests/data."""
process_group = None
workflow_spec_service = ProcessModelService()
if process_group_id is None:
process_group_id = dir_name
if not master_spec and not library:
process_group = assure_process_group_exists(process_group_id)
process_group_id = process_group.id

View File

@ -81,6 +81,16 @@ def test_get_process_groups_when_there_are_some(app, client: FlaskClient, with_b
assert len(rv.json) == 1
def test_get_process_group_when_found(app, client: FlaskClient, with_bpmn_file_cleanup):
user = find_or_create_user()
load_test_spec(app, "hello_world")
rv = client.get(
"/v1.0/process-group/hello_world", headers=logged_in_headers(user)
)
assert rv.status_code == 200
assert rv.json["id"] == "hello_world"
def create_process_model(app, client: FlaskClient):
"""Create_process_model."""
process_model_service = ProcessModelService()