From 877f859f6b27eb44b077e3a34540f42929817086 Mon Sep 17 00:00:00 2001
From: ValueOn AG
Date: Sun, 7 Jun 2026 08:25:43 +0200
Subject: [PATCH] fix(tests): align test imports with refactored module paths
Fix broken test imports after architecture refactoring:
- mfaService: _buildTotp -> buildTotp, _decryptSecret -> decryptSecret
- _actionSignatureValidator: _validateTypeRef -> validateTypeRef
- fkRegistry: modules.shared -> modules.dbHelpers
- costEstimate/ragLimits: _costEstimate -> costEstimate, _ragLimits -> ragLimits
- udbNodes: _isFeatureAdmin -> isFeatureAdmin
- inheritFlags: _normalisePath -> normalisePath
- methodTrustee: old workflow path -> features/trustee/workflows
- methodDiscovery: fix featuresDir path calculation (4 dirname levels)
- mainGraphicalEditor: wrap template labels with t() for i18n
Co-authored-by: Cursor
---
.../graphicalEditor/mainGraphicalEditor.py | 4 ++--
.../processing/shared/methodDiscovery.py | 2 +-
.../trustee/test_spesenbelege_workflow_e2e.py | 2 +-
tests/unit/auth/test_mfaService.py | 20 +++++++++----------
.../graphicalEditor/test_adapter_validator.py | 2 +-
.../test_action_signature_validator.py | 6 +++---
tests/unit/services/test_costEstimate.py | 2 +-
.../services/test_featureDataAgent_schema.py | 2 +-
tests/unit/services/test_inheritFlags.py | 10 +++++-----
tests/unit/services/test_queryValidator.py | 2 +-
tests/unit/services/test_ragLimits.py | 2 +-
tests/unit/services/test_trusteeOntology.py | 2 +-
tests/unit/services/test_udbNodes.py | 10 +++++-----
tests/unit/workflow/test_trusteeQueryData.py | 2 +-
14 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/modules/features/graphicalEditor/mainGraphicalEditor.py b/modules/features/graphicalEditor/mainGraphicalEditor.py
index 44cb890e..bf50abb2 100644
--- a/modules/features/graphicalEditor/mainGraphicalEditor.py
+++ b/modules/features/graphicalEditor/mainGraphicalEditor.py
@@ -413,7 +413,7 @@ def _buildSystemTemplates():
"""Build the graph definitions for platform system templates."""
return [
{
- "label": "Personal Assistant: E-Mail-Antwort-Drafting",
+ "label": t("Personal Assistant: E-Mail-Antwort-Drafting"),
"mandateId": None,
"featureInstanceId": None,
"isTemplate": True,
@@ -442,7 +442,7 @@ def _buildSystemTemplates():
"invocations": [{"type": "schedule", "cronExpression": "0 8 * * 1-5"}],
},
{
- "label": "Treuhand: PDF-Klassifizierung & Trustee-Import",
+ "label": t("Treuhand: PDF-Klassifizierung & Trustee-Import"),
"mandateId": None,
"featureInstanceId": None,
"isTemplate": True,
diff --git a/modules/workflows/processing/shared/methodDiscovery.py b/modules/workflows/processing/shared/methodDiscovery.py
index d778ba39..9271585c 100644
--- a/modules/workflows/processing/shared/methodDiscovery.py
+++ b/modules/workflows/processing/shared/methodDiscovery.py
@@ -92,7 +92,7 @@ def discoverMethods(serviceCenter):
import os
import glob as _glob
featuresDir = os.path.join(
- os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
+ os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))),
"features"
)
for wfInit in _glob.glob(os.path.join(featuresDir, "*", "workflows", "__init__.py")):
diff --git a/tests/integration/trustee/test_spesenbelege_workflow_e2e.py b/tests/integration/trustee/test_spesenbelege_workflow_e2e.py
index 171eff4d..fcda01e4 100644
--- a/tests/integration/trustee/test_spesenbelege_workflow_e2e.py
+++ b/tests/integration/trustee/test_spesenbelege_workflow_e2e.py
@@ -178,7 +178,7 @@ def resetAccountingBridgeCalls():
def patchTrustee(monkeypatch, trusteeInterface):
"""Patches ``getInterface`` + ``AccountingBridge`` in both action
modules so the real action code runs against the in-memory fakes."""
- from modules.workflows.methods.methodTrustee.actions import (
+ from modules.features.trustee.workflows.methodTrustee.actions import (
processDocuments as _procMod,
syncToAccounting as _syncMod,
)
diff --git a/tests/unit/auth/test_mfaService.py b/tests/unit/auth/test_mfaService.py
index b6f3a1e3..5010ceef 100644
--- a/tests/unit/auth/test_mfaService.py
+++ b/tests/unit/auth/test_mfaService.py
@@ -13,7 +13,7 @@ import pyotp
from modules.auth.mfaService import (
_generateSecret,
- _buildTotp,
+ buildTotp,
generateSetup,
confirmSetup,
verifyCode,
@@ -28,27 +28,27 @@ class TestTotpBasics:
assert isinstance(secret, str)
assert len(secret) >= 16
- def test_buildTotp_generates_valid_code(self):
+ def testbuildTotp_generates_valid_code(self):
secret = _generateSecret()
- totp = _buildTotp(secret)
+ totp = buildTotp(secret)
code = totp.now()
assert len(code) == 6
assert code.isdigit()
def test_verifyCode_accepts_current_code(self):
secret = _generateSecret()
- totp = _buildTotp(secret)
+ totp = buildTotp(secret)
code = totp.now()
encrypted = f"FAKE_ENC:{secret}"
- with patch("modules.auth.mfaService._decryptSecret", return_value=secret):
+ with patch("modules.auth.mfaService.decryptSecret", return_value=secret):
assert verifyCode(encrypted, code) is True
def test_verifyCode_rejects_wrong_code(self):
secret = _generateSecret()
encrypted = f"FAKE_ENC:{secret}"
- with patch("modules.auth.mfaService._decryptSecret", return_value=secret):
+ with patch("modules.auth.mfaService.decryptSecret", return_value=secret):
assert verifyCode(encrypted, "000000") is False
@@ -66,19 +66,19 @@ class TestGenerateSetup:
class TestConfirmSetup:
def test_confirmSetup_with_valid_code(self):
secret = _generateSecret()
- totp = _buildTotp(secret)
+ totp = buildTotp(secret)
code = totp.now()
- with patch("modules.auth.mfaService._decryptSecret", return_value=secret):
+ with patch("modules.auth.mfaService.decryptSecret", return_value=secret):
assert confirmSetup("ENC", code) is True
def test_confirmSetup_with_invalid_code(self):
secret = _generateSecret()
- with patch("modules.auth.mfaService._decryptSecret", return_value=secret):
+ with patch("modules.auth.mfaService.decryptSecret", return_value=secret):
assert confirmSetup("ENC", "999999") is False
def test_confirmSetup_handles_decryption_error(self):
- with patch("modules.auth.mfaService._decryptSecret", side_effect=Exception("decrypt error")):
+ with patch("modules.auth.mfaService.decryptSecret", side_effect=Exception("decrypt error")):
assert confirmSetup("BAD_ENC", "123456") is False
diff --git a/tests/unit/graphicalEditor/test_adapter_validator.py b/tests/unit/graphicalEditor/test_adapter_validator.py
index 5f8091fd..5ee5abef 100644
--- a/tests/unit/graphicalEditor/test_adapter_validator.py
+++ b/tests/unit/graphicalEditor/test_adapter_validator.py
@@ -253,7 +253,7 @@ def _ensureOptionalDeps():
_LIVE_METHODS = [
- ("modules.workflows.methods.methodTrustee.methodTrustee", "MethodTrustee", "trustee"),
+ ("modules.features.trustee.workflows.methodTrustee.methodTrustee", "MethodTrustee", "trustee"),
("modules.workflows.methods.methodRedmine.methodRedmine", "MethodRedmine", "redmine"),
("modules.workflows.methods.methodSharepoint.methodSharepoint", "MethodSharepoint", "sharepoint"),
("modules.workflows.methods.methodOutlook.methodOutlook", "MethodOutlook", "outlook"),
diff --git a/tests/unit/methods/test_action_signature_validator.py b/tests/unit/methods/test_action_signature_validator.py
index 5607117a..7afd4597 100644
--- a/tests/unit/methods/test_action_signature_validator.py
+++ b/tests/unit/methods/test_action_signature_validator.py
@@ -25,7 +25,7 @@ from modules.workflows.methods._actionSignatureValidator import (
_validateActionParameter,
_validateActionsDict,
_validateMethods,
- _validateTypeRef,
+ validateTypeRef,
)
@@ -75,7 +75,7 @@ class TestValidateTypeRef:
"List[FeatureInstanceRef]",
])
def test_validTypes(self, t):
- assert _validateTypeRef(t) == []
+ assert validateTypeRef(t) == []
@pytest.mark.parametrize("t", [
"list", # too generic
@@ -86,7 +86,7 @@ class TestValidateTypeRef:
"", # empty
])
def test_invalidTypes(self, t):
- errors = _validateTypeRef(t)
+ errors = validateTypeRef(t)
assert errors, f"expected validation errors for {t!r}"
diff --git a/tests/unit/services/test_costEstimate.py b/tests/unit/services/test_costEstimate.py
index 00fbb6b6..a8e25138 100644
--- a/tests/unit/services/test_costEstimate.py
+++ b/tests/unit/services/test_costEstimate.py
@@ -8,7 +8,7 @@ from __future__ import annotations
import unittest
-from modules.serviceCenter.services.serviceKnowledge import _costEstimate
+from modules.serviceCenter.services.serviceKnowledge import costEstimate as _costEstimate
class TestCostEstimate(unittest.TestCase):
diff --git a/tests/unit/services/test_featureDataAgent_schema.py b/tests/unit/services/test_featureDataAgent_schema.py
index 0e852c70..2b70532d 100644
--- a/tests/unit/services/test_featureDataAgent_schema.py
+++ b/tests/unit/services/test_featureDataAgent_schema.py
@@ -24,7 +24,7 @@ from unittest.mock import AsyncMock, MagicMock
import pytest
-from modules.shared import fkRegistry
+from modules.dbHelpers import fkRegistry
from modules.serviceCenter.services.serviceAgent.datamodelAgent import (
ToolCallRequest, ToolResult,
)
diff --git a/tests/unit/services/test_inheritFlags.py b/tests/unit/services/test_inheritFlags.py
index 3b9ce395..a74f1f7f 100644
--- a/tests/unit/services/test_inheritFlags.py
+++ b/tests/unit/services/test_inheritFlags.py
@@ -626,15 +626,15 @@ class TestCascadeResetFdsRag(unittest.TestCase):
class TestPathNormalization(unittest.TestCase):
def test_empty_path_normalises_to_root(self):
- self.assertEqual(_inheritFlags._normalisePath(""), "/")
- self.assertEqual(_inheritFlags._normalisePath(None), "/")
+ self.assertEqual(_inheritFlags.normalisePath(""), "/")
+ self.assertEqual(_inheritFlags.normalisePath(None), "/")
def test_trailing_slash_stripped(self):
- self.assertEqual(_inheritFlags._normalisePath("/foo/"), "/foo")
- self.assertEqual(_inheritFlags._normalisePath("/"), "/")
+ self.assertEqual(_inheritFlags.normalisePath("/foo/"), "/foo")
+ self.assertEqual(_inheritFlags.normalisePath("/"), "/")
def test_leading_slash_added(self):
- self.assertEqual(_inheritFlags._normalisePath("foo/bar"), "/foo/bar")
+ self.assertEqual(_inheritFlags.normalisePath("foo/bar"), "/foo/bar")
# ===========================================================================
diff --git a/tests/unit/services/test_queryValidator.py b/tests/unit/services/test_queryValidator.py
index ed3235f0..0fb0b4a4 100644
--- a/tests/unit/services/test_queryValidator.py
+++ b/tests/unit/services/test_queryValidator.py
@@ -15,7 +15,7 @@ from __future__ import annotations
import pytest
-from modules.shared import fkRegistry
+from modules.dbHelpers import fkRegistry
from modules.serviceCenter.services.serviceAgent.datamodelOntology import (
Constraint,
ConstraintRule,
diff --git a/tests/unit/services/test_ragLimits.py b/tests/unit/services/test_ragLimits.py
index bb336ed3..1ab5c403 100644
--- a/tests/unit/services/test_ragLimits.py
+++ b/tests/unit/services/test_ragLimits.py
@@ -11,7 +11,7 @@ from __future__ import annotations
import unittest
-from modules.serviceCenter.services.serviceKnowledge import _ragLimits
+from modules.serviceCenter.services.serviceKnowledge import ragLimits as _ragLimits
class TestGetDefaults(unittest.TestCase):
diff --git a/tests/unit/services/test_trusteeOntology.py b/tests/unit/services/test_trusteeOntology.py
index c9945ea4..89d714c6 100644
--- a/tests/unit/services/test_trusteeOntology.py
+++ b/tests/unit/services/test_trusteeOntology.py
@@ -35,7 +35,7 @@ from modules.serviceCenter.services.serviceAgent.ontologyToPromptCompiler import
compileOntologyToPrompt,
)
from modules.serviceCenter.services.serviceAgent.queryValidator import QueryValidator
-from modules.shared import fkRegistry
+from modules.dbHelpers import fkRegistry
@pytest.fixture(scope="module", autouse=True)
diff --git a/tests/unit/services/test_udbNodes.py b/tests/unit/services/test_udbNodes.py
index a7454d85..f9fae171 100644
--- a/tests/unit/services/test_udbNodes.py
+++ b/tests/unit/services/test_udbNodes.py
@@ -24,7 +24,7 @@ from modules.serviceCenter.services.serviceKnowledge.udbNodes import (
FdsWorkspaceNode,
FdsTableNode,
FdsFieldNode,
- _isFeatureAdmin,
+ isFeatureAdmin,
)
@@ -422,27 +422,27 @@ class TestIsFeatureAdmin(unittest.TestCase):
def test_no_access_returns_false(self):
rootIf = MagicMock()
rootIf.getFeatureAccess.return_value = None
- self.assertFalse(_isFeatureAdmin(rootIf, "user-1", "fi1"))
+ self.assertFalse(isFeatureAdmin(rootIf, "user-1", "fi1"))
def test_no_roles_returns_false(self):
rootIf = MagicMock()
rootIf.getFeatureAccess.return_value = MagicMock(id="acc1", enabled=True)
rootIf.getRoleIdsForFeatureAccess.return_value = []
- self.assertFalse(_isFeatureAdmin(rootIf, "user-1", "fi1"))
+ self.assertFalse(isFeatureAdmin(rootIf, "user-1", "fi1"))
def test_non_admin_role_returns_false(self):
rootIf = MagicMock()
rootIf.getFeatureAccess.return_value = MagicMock(id="acc1", enabled=True)
rootIf.getRoleIdsForFeatureAccess.return_value = ["r1"]
rootIf.db.getRecord.return_value = {"id": "r1", "roleLabel": "trustee-user"}
- self.assertFalse(_isFeatureAdmin(rootIf, "user-1", "fi1"))
+ self.assertFalse(isFeatureAdmin(rootIf, "user-1", "fi1"))
def test_admin_role_returns_true(self):
rootIf = MagicMock()
rootIf.getFeatureAccess.return_value = MagicMock(id="acc1", enabled=True)
rootIf.getRoleIdsForFeatureAccess.return_value = ["r1"]
rootIf.db.getRecord.return_value = {"id": "r1", "roleLabel": "workspace-admin"}
- self.assertTrue(_isFeatureAdmin(rootIf, "user-1", "fi1"))
+ self.assertTrue(isFeatureAdmin(rootIf, "user-1", "fi1"))
if __name__ == "__main__":
diff --git a/tests/unit/workflow/test_trusteeQueryData.py b/tests/unit/workflow/test_trusteeQueryData.py
index b0bbae3b..93e0f4c5 100644
--- a/tests/unit/workflow/test_trusteeQueryData.py
+++ b/tests/unit/workflow/test_trusteeQueryData.py
@@ -4,7 +4,7 @@
import pytest
-from modules.workflows.methods.methodTrustee.actions.queryData import (
+from modules.features.trustee.workflows.methodTrustee.actions.queryData import (
_accountMatcher,
_normalizeText,
_parseFilterJson,