2022-10-20 11:19:24 +00:00
|
|
|
"""Test_various_bpmn_constructs."""
|
|
|
|
from flask.app import Flask
|
|
|
|
from spiffworkflow_backend.services.secret_service import SecretService
|
|
|
|
from spiffworkflow_backend.services.service_task_service import ServiceTaskDelegate
|
2022-10-28 02:03:49 +00:00
|
|
|
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
|
2022-10-20 11:19:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TestServiceTaskDelegate(BaseTest):
|
|
|
|
"""TestServiceTaskDelegate."""
|
|
|
|
|
2022-10-21 20:46:41 +00:00
|
|
|
def test_check_prefixes_without_secret(
|
2022-10-20 11:19:24 +00:00
|
|
|
self, app: Flask, with_db_and_bpmn_file_cleanup: None
|
|
|
|
) -> None:
|
2022-10-21 20:46:41 +00:00
|
|
|
"""Test_check_prefixes_without_secret."""
|
|
|
|
result = ServiceTaskDelegate.check_prefixes("hey")
|
2022-10-20 11:19:24 +00:00
|
|
|
assert result == "hey"
|
|
|
|
|
2022-10-21 20:46:41 +00:00
|
|
|
def test_check_prefixes_with_int(
|
2022-10-20 11:19:24 +00:00
|
|
|
self, app: Flask, with_db_and_bpmn_file_cleanup: None
|
|
|
|
) -> None:
|
2022-10-21 20:46:41 +00:00
|
|
|
"""Test_check_prefixes_with_int."""
|
|
|
|
result = ServiceTaskDelegate.check_prefixes(1)
|
2022-10-20 11:19:24 +00:00
|
|
|
assert result == 1
|
|
|
|
|
2022-10-21 20:46:41 +00:00
|
|
|
def test_check_prefixes_with_secret(
|
2022-10-20 11:19:24 +00:00
|
|
|
self, app: Flask, with_db_and_bpmn_file_cleanup: None
|
|
|
|
) -> None:
|
2022-10-21 20:46:41 +00:00
|
|
|
"""Test_check_prefixes_with_secret."""
|
2022-10-20 11:19:24 +00:00
|
|
|
user = self.find_or_create_user("test_user")
|
|
|
|
SecretService().add_secret("hot_secret", "my_secret_value", user.id)
|
2022-10-21 20:46:41 +00:00
|
|
|
result = ServiceTaskDelegate.check_prefixes("secret:hot_secret")
|
2022-10-20 11:19:24 +00:00
|
|
|
assert result == "my_secret_value"
|