rename exception to match conventions
This commit is contained in:
parent
51109d26d7
commit
97bbf1ba45
|
@ -1,5 +0,0 @@
|
|||
"""Process_entity_not_found."""
|
||||
|
||||
|
||||
class ProcessEntityNotFound(Exception):
|
||||
"""ProcessEntityNotFound."""
|
|
@ -0,0 +1,5 @@
|
|||
"""Process_entity_not_found."""
|
||||
|
||||
|
||||
class ProcessEntityNotFoundError(Exception):
|
||||
"""ProcessEntityNotFoundError."""
|
|
@ -15,8 +15,8 @@ from flask_bpmn.api.api_error import ApiError
|
|||
from flask_bpmn.models.db import db
|
||||
from werkzeug.datastructures import FileStorage
|
||||
|
||||
from spiffworkflow_backend.exceptions.process_entity_not_found import (
|
||||
ProcessEntityNotFound,
|
||||
from spiffworkflow_backend.exceptions.process_entity_not_found_error import (
|
||||
ProcessEntityNotFoundError,
|
||||
)
|
||||
from spiffworkflow_backend.models.file import FileSchema
|
||||
from spiffworkflow_backend.models.file import FileType
|
||||
|
@ -154,7 +154,7 @@ def process_model_show(
|
|||
process_model.files = files
|
||||
process_model_json = ProcessModelInfoSchema().dump(process_model)
|
||||
return process_model_json
|
||||
except ProcessEntityNotFound as exception:
|
||||
except ProcessEntityNotFoundError as exception:
|
||||
raise (
|
||||
ApiError(
|
||||
code="process_mode_cannot_be_found",
|
||||
|
|
|
@ -10,8 +10,8 @@ from typing import Union
|
|||
|
||||
from flask_bpmn.api.api_error import ApiError
|
||||
|
||||
from spiffworkflow_backend.exceptions.process_entity_not_found import (
|
||||
ProcessEntityNotFound,
|
||||
from spiffworkflow_backend.exceptions.process_entity_not_found_error import (
|
||||
ProcessEntityNotFoundError,
|
||||
)
|
||||
from spiffworkflow_backend.models.process_group import ProcessGroup
|
||||
from spiffworkflow_backend.models.process_group import ProcessGroupSchema
|
||||
|
@ -106,7 +106,7 @@ class ProcessModelService(FileSystemService):
|
|||
) -> ProcessModelInfo:
|
||||
"""Get a process model from a model and group id."""
|
||||
if not os.path.exists(FileSystemService.root_path()):
|
||||
raise ProcessEntityNotFound("process_model_not_found")
|
||||
raise ProcessEntityNotFoundError("process_model_not_found")
|
||||
|
||||
master_spec = self.get_master_spec()
|
||||
if master_spec and master_spec.id == process_model_id:
|
||||
|
@ -129,7 +129,7 @@ class ProcessModelService(FileSystemService):
|
|||
process_group_dir
|
||||
)
|
||||
return self.__scan_spec(sd.path, sd.name, process_group)
|
||||
raise ProcessEntityNotFound("process_model_not_found")
|
||||
raise ProcessEntityNotFoundError("process_model_not_found")
|
||||
|
||||
def get_process_models(
|
||||
self, process_group_id: Optional[str] = None
|
||||
|
|
|
@ -7,8 +7,8 @@ from flask.app import Flask
|
|||
from flask_bpmn.models.db import db
|
||||
from tests.spiffworkflow_backend.helpers.example_data import ExampleDataLoader
|
||||
|
||||
from spiffworkflow_backend.exceptions.process_entity_not_found import (
|
||||
ProcessEntityNotFound,
|
||||
from spiffworkflow_backend.exceptions.process_entity_not_found_error import (
|
||||
ProcessEntityNotFoundError,
|
||||
)
|
||||
from spiffworkflow_backend.models.process_group import ProcessGroup
|
||||
from spiffworkflow_backend.models.process_model import ProcessModelInfo
|
||||
|
@ -67,7 +67,7 @@ def load_test_spec(
|
|||
return workflow_spec_service.get_process_model(
|
||||
process_model_id, group_id=process_group_id
|
||||
)
|
||||
except ProcessEntityNotFound:
|
||||
except ProcessEntityNotFoundError:
|
||||
spec = ExampleDataLoader().create_spec(
|
||||
id=process_model_id,
|
||||
master_spec=master_spec,
|
||||
|
|
|
@ -15,8 +15,8 @@ from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
|
|||
from tests.spiffworkflow_backend.helpers.test_data import logged_in_headers
|
||||
from werkzeug.test import TestResponse
|
||||
|
||||
from spiffworkflow_backend.exceptions.process_entity_not_found import (
|
||||
ProcessEntityNotFound,
|
||||
from spiffworkflow_backend.exceptions.process_entity_not_found_error import (
|
||||
ProcessEntityNotFoundError,
|
||||
)
|
||||
from spiffworkflow_backend.models.process_group import ProcessGroup
|
||||
from spiffworkflow_backend.models.process_group import ProcessGroupSchema
|
||||
|
@ -74,7 +74,7 @@ def test_process_model_delete(
|
|||
assert response.json["ok"] is True
|
||||
|
||||
# assert we no longer have a model
|
||||
with pytest.raises(ProcessEntityNotFound):
|
||||
with pytest.raises(ProcessEntityNotFoundError):
|
||||
ProcessModelService().get_process_model("make_cookies")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue