Merge branch 'dev'
# Conflicts: # src/spiffworkflow_backend/routes/process_api_blueprint.py # tests/spiffworkflow_backend/integration/test_process_api.py
This commit is contained in:
commit
7c82415757
|
@ -8,6 +8,7 @@
|
|||
/dist/
|
||||
/docs/_build/
|
||||
/src/*.egg-info/
|
||||
/src/instance
|
||||
__pycache__/
|
||||
*.sqlite3
|
||||
node_modules
|
||||
|
|
|
@ -46,6 +46,13 @@ paths:
|
|||
$ref: "#/components/schemas/WorkflowSpecCategory"
|
||||
|
||||
/process-groups/{process_group_id}:
|
||||
parameters:
|
||||
- name: process_group_id
|
||||
in: path
|
||||
required: true
|
||||
description: The unique id of an existing process group.
|
||||
schema:
|
||||
type: string
|
||||
# process_group_show
|
||||
get:
|
||||
operationId: spiffworkflow_backend.routes.process_api_blueprint.process_group_show
|
||||
|
@ -59,6 +66,14 @@ paths:
|
|||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/WorkflowSpecCategory"
|
||||
delete:
|
||||
operationId: spiffworkflow_backend.routes.process_api_blueprint.process_group_delete
|
||||
summary: Deletes a single process group
|
||||
tags:
|
||||
- Process Groups
|
||||
responses:
|
||||
"204":
|
||||
description: The process group was deleted.
|
||||
|
||||
/process-models:
|
||||
# process_model_add
|
||||
|
@ -125,12 +140,18 @@ paths:
|
|||
# items:
|
||||
# $ref: "#/components/schemas/File"
|
||||
|
||||
/process-models/{process_model_id}:
|
||||
/process-models/{process_group_id}/{process_model_id}:
|
||||
parameters:
|
||||
- name: process_model_id
|
||||
in: path
|
||||
required: true
|
||||
description: The unique id of an existing workflow specification.
|
||||
description: The unique id of an existing process model.
|
||||
schema:
|
||||
type: string
|
||||
- name: process_group_id
|
||||
in: path
|
||||
required: true
|
||||
description: The unique id of an existing process group
|
||||
schema:
|
||||
type: string
|
||||
# process_model_show
|
||||
|
|
|
@ -48,8 +48,8 @@ def process_group_add(body):
|
|||
|
||||
|
||||
def process_group_delete(process_group_id):
|
||||
"""Process_groups_delete."""
|
||||
...
|
||||
ProcessModelService().process_group_delete(process_group_id)
|
||||
print("process_group_delete")
|
||||
|
||||
|
||||
def process_groups_list():
|
||||
|
@ -83,14 +83,15 @@ def process_model_add(body):
|
|||
)
|
||||
|
||||
|
||||
def process_model_delete(process_model_id):
|
||||
def process_model_delete(process_group_id, process_model_id):
|
||||
"""Process_model_delete."""
|
||||
ProcessModelService().process_model_delete(process_model_id)
|
||||
print("process_model_delete")
|
||||
|
||||
|
||||
def process_model_show(process_model_id):
|
||||
def process_model_show(process_group_id, process_model_id):
|
||||
"""Process_model_show."""
|
||||
process_model = ProcessModelService().get_spec(process_model_id)
|
||||
process_model = ProcessModelService().get_spec(process_model_id, process_group_id)
|
||||
if process_model is None:
|
||||
raise (
|
||||
ApiError(
|
||||
|
|
|
@ -69,7 +69,7 @@ class ProcessModelService(FileSystemService):
|
|||
if os.path.exists(path):
|
||||
return self.__scan_spec(path, FileSystemService.MASTER_SPECIFICATION)
|
||||
|
||||
def get_spec(self, spec_id):
|
||||
def get_spec(self, spec_id, group_id=None):
|
||||
"""Get_spec."""
|
||||
if not os.path.exists(FileSystemService.root_path()):
|
||||
return # Nothing to scan yet. There are no files.
|
||||
|
@ -77,6 +77,10 @@ class ProcessModelService(FileSystemService):
|
|||
master_spec = self.get_master_spec()
|
||||
if master_spec and master_spec.id == spec_id:
|
||||
return master_spec
|
||||
if group_id is not None:
|
||||
for process_model in self.get_process_group(group_id).process_models:
|
||||
if spec_id == process_model.id:
|
||||
return process_model
|
||||
with os.scandir(FileSystemService.root_path()) as process_group_dirs:
|
||||
for item in process_group_dirs:
|
||||
process_group_dir = item
|
||||
|
|
|
@ -32,7 +32,7 @@ def with_bpmn_file_cleanup():
|
|||
|
||||
|
||||
# phase 1: req_id: 7.1 Deploy process
|
||||
def test_add_new_process_model(app, client: FlaskClient, with_bpmn_file_cleanup):
|
||||
def test_process_model_add(app, client: FlaskClient, with_bpmn_file_cleanup):
|
||||
"""Test_add_new_process_model."""
|
||||
create_process_model(app, client)
|
||||
create_spec_file(app, client)
|
||||
|
@ -50,7 +50,8 @@ def test_process_model_delete(app, client: FlaskClient, with_bpmn_file_cleanup):
|
|||
# delete the model
|
||||
user = find_or_create_user()
|
||||
response = client.delete(
|
||||
f"/v1.0/process-models/{process_model.id}", headers=logged_in_headers(user)
|
||||
f"/v1.0/process-models/{process_model.process_group_id}/{process_model.id}",
|
||||
headers=logged_in_headers(user),
|
||||
)
|
||||
assert response.status_code == 204
|
||||
|
||||
|
@ -108,7 +109,9 @@ def test_process_group_delete(app, client: FlaskClient, with_bpmn_file_cleanup):
|
|||
assert persisted is not None
|
||||
assert persisted.id == process_group_id
|
||||
|
||||
client.delete(f"/v1.0/process-models/{process_group_id}")
|
||||
client.delete(
|
||||
f"/v1.0/process-groups/{process_group_id}", headers=logged_in_headers(user)
|
||||
)
|
||||
|
||||
print(f"test_process_group_delete: {__name__}")
|
||||
|
||||
|
@ -223,7 +226,7 @@ def test_get_process_model_when_found(app, client: FlaskClient, with_bpmn_file_c
|
|||
process_model_dir_name = "hello_world"
|
||||
load_test_spec(app, process_model_dir_name, process_group_id=test_process_group_id)
|
||||
response = client.get(
|
||||
f"/v1.0/process-models/{process_model_dir_name}",
|
||||
f"/v1.0/process-models/{test_process_group_id}/{process_model_dir_name}",
|
||||
headers=logged_in_headers(user),
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
@ -238,8 +241,9 @@ def test_get_process_model_when_not_found(
|
|||
"""Test_get_process_model_when_not_found."""
|
||||
user = find_or_create_user()
|
||||
process_model_dir_name = "THIS_NO_EXISTS"
|
||||
group = create_process_group(client, user, "my_group")
|
||||
response = client.get(
|
||||
f"/v1.0/process-models/{process_model_dir_name}",
|
||||
f"/v1.0/process-models/{group.json['id']}/{process_model_dir_name}",
|
||||
headers=logged_in_headers(user),
|
||||
)
|
||||
assert response.status_code == 400
|
||||
|
@ -351,7 +355,8 @@ def create_process_instance(
|
|||
"""Create_process_instance."""
|
||||
load_test_spec(app, process_model_dir_name, process_group_id=test_process_group_id)
|
||||
response = client.post(
|
||||
f"/v1.0/process-models/{process_model_dir_name}", headers=headers
|
||||
f"/v1.0/process-models/{process_group_id}/{process_model_dir_name}",
|
||||
headers=headers,
|
||||
)
|
||||
assert response.status_code == 201
|
||||
assert response.json["status"] == "complete"
|
||||
|
|
Loading…
Reference in New Issue