Merge remote-tracking branch 'origin/main' into feature/process_instance_search

This commit is contained in:
jasquat 2022-09-23 10:53:15 -04:00
commit a0eba9ed33
4 changed files with 9 additions and 8 deletions

View File

@ -1104,7 +1104,7 @@ def get_spiff_task_from_process_instance(
#
# Methods for secrets CRUD - maybe move somewhere else:
#
def get_secret(key: str) -> str | None:
def get_secret(key: str) -> Optional[str]:
"""Get_secret."""
return SecretService.get_secret(key)

View File

@ -1,6 +1,7 @@
"""Logging_service."""
import json
import logging
import re
from typing import Any
from typing import Optional
@ -113,6 +114,8 @@ def setup_logger(app: Flask) -> None:
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
app.logger.debug("Printing log to create app logger")
# the json formatter is nice for real environments but makes
# debugging locally a little more difficult
if app.env != "development":
@ -140,7 +143,8 @@ def setup_logger(app: Flask) -> None:
# make all loggers act the same
for name in logging.root.manager.loggerDict:
if "spiff" not in name:
# use a regex so spiffworkflow_backend isn't filtered out
if not re.match(r"^spiff\b", name):
the_logger = logging.getLogger(name)
the_logger.setLevel(log_level)
if spiff_logger_filehandler:

View File

@ -54,7 +54,7 @@ class SecretService:
return secret_model
@staticmethod
def get_secret(key: str) -> str | None:
def get_secret(key: str) -> Optional[str]:
"""Get_secret."""
secret: SecretModel = (
db.session.query(SecretModel).filter(SecretModel.key == key).first()

View File

@ -94,7 +94,7 @@ class TestSecretService(SecretServiceTestHelpers):
self.add_test_secret(user)
with pytest.raises(ApiError) as ae:
self.add_test_secret(user)
assert "Duplicate entry" in ae.value.message
assert ae.value.code == "create_secret_error"
def test_get_secret(self, app: Flask, with_db_and_bpmn_file_cleanup: None) -> None:
"""Test_get_secret."""
@ -151,6 +151,7 @@ class TestSecretService(SecretServiceTestHelpers):
with pytest.raises(ApiError) as ae:
SecretService.update_secret(secret.key + "x", "some_new_value", user.id)
assert "Resource does not exist" in ae.value.message
assert ae.value.code == "update_secret_error"
def test_delete_secret(
self, app: Flask, client: FlaskClient, with_db_and_bpmn_file_cleanup: None
@ -244,8 +245,6 @@ class TestSecretService(SecretServiceTestHelpers):
allowed_relative_path=process_model_relative_path,
)
assert "Resource already exists" in ae.value.message
assert "IntegrityError" in ae.value.message
assert "Duplicate entry" in ae.value.message
def test_secret_add_allowed_process_bad_user_fails(
self, app: Flask, client: FlaskClient, with_db_and_bpmn_file_cleanup: None
@ -286,7 +285,6 @@ class TestSecretService(SecretServiceTestHelpers):
allowed_relative_path=process_model_relative_path,
)
assert "Resource does not exist" in ae.value.message
print("test_secret_add_allowed_process_bad_secret")
def test_secret_delete_allowed_process(
self, app: Flask, client: FlaskClient, with_db_and_bpmn_file_cleanup: None
@ -438,7 +436,6 @@ class TestSecretServiceApi(SecretServiceTestHelpers):
headers=self.logged_in_headers(user),
)
assert secret_response.status_code == 404
print("test_delete_secret_bad_key")
def test_add_secret_allowed_process(
self, app: Flask, client: FlaskClient, with_db_and_bpmn_file_cleanup: None