This commit is contained in:
burnettk 2022-11-25 00:46:43 -05:00
parent ec8efa87d9
commit ecee3c4548
6 changed files with 30 additions and 17 deletions

View File

@ -1,5 +1,3 @@
from __future__ import with_statement
import logging
from logging.config import fileConfig

View File

@ -242,7 +242,7 @@ def process_group_show(
def process_group_move(
modified_process_group_identifier: str, new_location: str
) -> flask.wrappers.Response:
"""process_group_move."""
"""Process_group_move."""
original_process_group_id = un_modify_modified_process_model_id(
modified_process_group_identifier
)
@ -343,7 +343,7 @@ def process_model_show(modified_process_model_identifier: str) -> Any:
def process_model_move(
modified_process_model_identifier: str, new_location: str
) -> flask.wrappers.Response:
"""process_model_move."""
"""Process_model_move."""
original_process_model_id = un_modify_modified_process_model_id(
modified_process_model_identifier
)

View File

@ -47,11 +47,14 @@ class ProcessModelService(FileSystemService):
@classmethod
def is_group_identifier(cls, process_group_identifier: str) -> bool:
"""Is_group_identifier."""
if os.path.exists(FileSystemService.root_path()):
process_group_path = os.path.abspath(
os.path.join(
FileSystemService.root_path(),
FileSystemService.id_string_to_relative_path(process_group_identifier),
FileSystemService.id_string_to_relative_path(
process_group_identifier
),
)
)
return cls.is_group(process_group_path)
@ -68,11 +71,14 @@ class ProcessModelService(FileSystemService):
@classmethod
def is_model_identifier(cls, process_model_identifier: str) -> bool:
"""Is_model_identifier."""
if os.path.exists(FileSystemService.root_path()):
process_model_path = os.path.abspath(
os.path.join(
FileSystemService.root_path(),
FileSystemService.id_string_to_relative_path(process_model_identifier),
FileSystemService.id_string_to_relative_path(
process_model_identifier
),
)
)
return cls.is_model(process_model_path)
@ -150,7 +156,7 @@ class ProcessModelService(FileSystemService):
def process_model_move(
self, original_process_model_id: str, new_location: str
) -> ProcessModelInfo:
"""process_model_move."""
"""Process_model_move."""
original_model_path = os.path.abspath(
os.path.join(FileSystemService.root_path(), original_process_model_id)
)
@ -300,7 +306,7 @@ class ProcessModelService(FileSystemService):
def process_group_move(
self, original_process_group_id: str, new_location: str
) -> ProcessGroup:
"""process_group_move."""
"""Process_group_move."""
original_group_path = self.process_group_path(original_process_group_id)
original_root, original_group_id = os.path.split(original_group_path)
new_root = f"{FileSystemService.root_path()}/{new_location}"

View File

@ -261,7 +261,7 @@ class BaseTest:
load_test_spec(
process_model_id=test_process_model_id,
process_model_source_directory=basename,
bpmn_file_name=basename
bpmn_file_name=basename,
)
modified_process_model_id = test_process_model_id.replace("/", ":")
response = client.post(

View File

@ -2436,7 +2436,7 @@ class TestProcessApi(BaseTest):
def setup_initial_groups_for_move_tests(
self, client: FlaskClient, with_super_admin_user: UserModel
) -> None:
"""setup_initial_groups_for_move_tests."""
"""Setup_initial_groups_for_move_tests."""
groups = ["group_a", "group_b", "group_b/group_bb"]
# setup initial groups
for group in groups:
@ -2456,7 +2456,7 @@ class TestProcessApi(BaseTest):
with_db_and_bpmn_file_cleanup: None,
with_super_admin_user: UserModel,
) -> None:
"""test_move_model."""
"""Test_move_model."""
self.setup_initial_groups_for_move_tests(client, with_super_admin_user)
process_model_id = "test_model"
@ -2508,7 +2508,7 @@ class TestProcessApi(BaseTest):
with_db_and_bpmn_file_cleanup: None,
with_super_admin_user: UserModel,
) -> None:
"""test_move_group."""
"""Test_move_group."""
self.setup_initial_groups_for_move_tests(client, with_super_admin_user)
# add sub group to `group_a`

View File

@ -1,9 +1,10 @@
"""Test_acceptance_test_fixtures."""
from flask.app import Flask
import os
from flask.app import Flask
from spiffworkflow_backend.models.process_group import ProcessGroup
from spiffworkflow_backend.models.process_model import ProcessModelInfo
from spiffworkflow_backend.services.acceptance_test_fixtures import (
load_acceptance_test_fixtures,
)
@ -12,17 +13,25 @@ from spiffworkflow_backend.services.process_model_service import ProcessModelSer
def test_start_dates_are_one_hour_apart(app: Flask) -> None:
"""Test_start_dates_are_one_hour_apart."""
process_model_identifier = 'misc/acceptance-tests-group-one/acceptance-tests-model-1'
process_model_identifier = (
"misc/acceptance-tests-group-one/acceptance-tests-model-1"
)
group_identifier = os.path.dirname(process_model_identifier)
parent_group_identifier = os.path.dirname(group_identifier)
if not ProcessModelService.is_group(parent_group_identifier):
process_group = ProcessGroup(id=parent_group_identifier, display_name=parent_group_identifier)
process_group = ProcessGroup(
id=parent_group_identifier, display_name=parent_group_identifier
)
ProcessModelService.add_process_group(process_group)
if not ProcessModelService.is_group(group_identifier):
process_group = ProcessGroup(id=group_identifier, display_name=group_identifier)
ProcessModelService.add_process_group(process_group)
if not ProcessModelService.is_model(process_model_identifier):
process_model = ProcessModelInfo(id=process_model_identifier, display_name=process_model_identifier, description='hey')
process_model = ProcessModelInfo(
id=process_model_identifier,
display_name=process_model_identifier,
description="hey",
)
ProcessModelService.add_process_model(process_model)
process_instances = load_acceptance_test_fixtures()