fix(test): update methodTrustee path in signature validator parametrize
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
877f859f6b
commit
2b208ee504
2 changed files with 29 additions and 31 deletions
|
|
@ -46,8 +46,6 @@ from modules.datamodels.datamodelWorkflowAutomation import (
|
||||||
AutoRun,
|
AutoRun,
|
||||||
AutoStepLog,
|
AutoStepLog,
|
||||||
AutoTask,
|
AutoTask,
|
||||||
Automation2Workflow,
|
|
||||||
Automation2WorkflowRun,
|
|
||||||
)
|
)
|
||||||
from modules.features.graphicalEditor.entryPoints import invocations_synced_with_graph
|
from modules.features.graphicalEditor.entryPoints import invocations_synced_with_graph
|
||||||
from modules.connectors.connectorDbPostgre import DatabaseConnector
|
from modules.connectors.connectorDbPostgre import DatabaseConnector
|
||||||
|
|
@ -96,11 +94,11 @@ def getAllWorkflowsForScheduling() -> List[Dict[str, Any]]:
|
||||||
dbPort=dbPort,
|
dbPort=dbPort,
|
||||||
userId=None,
|
userId=None,
|
||||||
)
|
)
|
||||||
if not connector._ensureTableExists(Automation2Workflow):
|
if not connector._ensureTableExists(AutoWorkflow):
|
||||||
logger.warning("GraphicalEditor schedule: table Automation2Workflow does not exist yet")
|
logger.warning("GraphicalEditor schedule: table AutoWorkflow does not exist yet")
|
||||||
return []
|
return []
|
||||||
records = connector.getRecordset(
|
records = connector.getRecordset(
|
||||||
Automation2Workflow,
|
AutoWorkflow,
|
||||||
recordFilter=None,
|
recordFilter=None,
|
||||||
)
|
)
|
||||||
raw_count = len(records) if records else 0
|
raw_count = len(records) if records else 0
|
||||||
|
|
@ -191,7 +189,7 @@ class GraphicalEditorObjects:
|
||||||
|
|
||||||
def getWorkflows(self, active: Optional[bool] = None) -> List[Dict[str, Any]]:
|
def getWorkflows(self, active: Optional[bool] = None) -> List[Dict[str, Any]]:
|
||||||
"""Get all workflows for this mandate (cross-instance)."""
|
"""Get all workflows for this mandate (cross-instance)."""
|
||||||
if not self.db._ensureTableExists(Automation2Workflow):
|
if not self.db._ensureTableExists(AutoWorkflow):
|
||||||
return []
|
return []
|
||||||
rf: Dict[str, Any] = {
|
rf: Dict[str, Any] = {
|
||||||
"mandateId": self.mandateId,
|
"mandateId": self.mandateId,
|
||||||
|
|
@ -199,7 +197,7 @@ class GraphicalEditorObjects:
|
||||||
if active is not None:
|
if active is not None:
|
||||||
rf["active"] = active
|
rf["active"] = active
|
||||||
records = self.db.getRecordset(
|
records = self.db.getRecordset(
|
||||||
Automation2Workflow,
|
AutoWorkflow,
|
||||||
recordFilter=rf,
|
recordFilter=rf,
|
||||||
)
|
)
|
||||||
rows = [dict(r) for r in records] if records else []
|
rows = [dict(r) for r in records] if records else []
|
||||||
|
|
@ -209,10 +207,10 @@ class GraphicalEditorObjects:
|
||||||
|
|
||||||
def getWorkflow(self, workflowId: str) -> Optional[Dict[str, Any]]:
|
def getWorkflow(self, workflowId: str) -> Optional[Dict[str, Any]]:
|
||||||
"""Get a single workflow by ID (mandate-scoped, cross-instance)."""
|
"""Get a single workflow by ID (mandate-scoped, cross-instance)."""
|
||||||
if not self.db._ensureTableExists(Automation2Workflow):
|
if not self.db._ensureTableExists(AutoWorkflow):
|
||||||
return None
|
return None
|
||||||
records = self.db.getRecordset(
|
records = self.db.getRecordset(
|
||||||
Automation2Workflow,
|
AutoWorkflow,
|
||||||
recordFilter={
|
recordFilter={
|
||||||
"id": workflowId,
|
"id": workflowId,
|
||||||
"mandateId": self.mandateId,
|
"mandateId": self.mandateId,
|
||||||
|
|
@ -235,7 +233,7 @@ class GraphicalEditorObjects:
|
||||||
if "active" not in data or data.get("active") is None:
|
if "active" not in data or data.get("active") is None:
|
||||||
data["active"] = True
|
data["active"] = True
|
||||||
data["invocations"] = invocations_synced_with_graph(data.get("graph") or {}, data.get("invocations"))
|
data["invocations"] = invocations_synced_with_graph(data.get("graph") or {}, data.get("invocations"))
|
||||||
created = self.db.recordCreate(Automation2Workflow, data)
|
created = self.db.recordCreate(AutoWorkflow, data)
|
||||||
out = dict(created)
|
out = dict(created)
|
||||||
out["invocations"] = invocations_synced_with_graph(out.get("graph") or {}, out.get("invocations"))
|
out["invocations"] = invocations_synced_with_graph(out.get("graph") or {}, out.get("invocations"))
|
||||||
try:
|
try:
|
||||||
|
|
@ -258,7 +256,7 @@ class GraphicalEditorObjects:
|
||||||
g = {}
|
g = {}
|
||||||
inv = data["invocations"] if "invocations" in data else existing.get("invocations")
|
inv = data["invocations"] if "invocations" in data else existing.get("invocations")
|
||||||
data["invocations"] = invocations_synced_with_graph(g, inv)
|
data["invocations"] = invocations_synced_with_graph(g, inv)
|
||||||
updated = self.db.recordModify(Automation2Workflow, workflowId, data)
|
updated = self.db.recordModify(AutoWorkflow, workflowId, data)
|
||||||
out = dict(updated)
|
out = dict(updated)
|
||||||
out["invocations"] = invocations_synced_with_graph(out.get("graph") or {}, out.get("invocations"))
|
out["invocations"] = invocations_synced_with_graph(out.get("graph") or {}, out.get("invocations"))
|
||||||
try:
|
try:
|
||||||
|
|
@ -273,7 +271,7 @@ class GraphicalEditorObjects:
|
||||||
existing = self.getWorkflow(workflowId)
|
existing = self.getWorkflow(workflowId)
|
||||||
if not existing:
|
if not existing:
|
||||||
return False
|
return False
|
||||||
self.db.recordDelete(Automation2Workflow, workflowId)
|
self.db.recordDelete(AutoWorkflow, workflowId)
|
||||||
try:
|
try:
|
||||||
from modules.shared.callbackRegistry import callbackRegistry
|
from modules.shared.callbackRegistry import callbackRegistry
|
||||||
callbackRegistry.trigger(_CALLBACK_WORKFLOW_CHANGED)
|
callbackRegistry.trigger(_CALLBACK_WORKFLOW_CHANGED)
|
||||||
|
|
@ -305,15 +303,15 @@ class GraphicalEditorObjects:
|
||||||
"mandateId": ctx.get("mandateId") or self.mandateId,
|
"mandateId": ctx.get("mandateId") or self.mandateId,
|
||||||
"ownerId": ctx.get("userId") or (self.currentUser.id if self.currentUser else None),
|
"ownerId": ctx.get("userId") or (self.currentUser.id if self.currentUser else None),
|
||||||
}
|
}
|
||||||
created = self.db.recordCreate(Automation2WorkflowRun, data)
|
created = self.db.recordCreate(AutoRun, data)
|
||||||
return dict(created)
|
return dict(created)
|
||||||
|
|
||||||
def getRun(self, runId: str) -> Optional[Dict[str, Any]]:
|
def getRun(self, runId: str) -> Optional[Dict[str, Any]]:
|
||||||
"""Get a run by ID."""
|
"""Get a run by ID."""
|
||||||
if not self.db._ensureTableExists(Automation2WorkflowRun):
|
if not self.db._ensureTableExists(AutoRun):
|
||||||
return None
|
return None
|
||||||
records = self.db.getRecordset(
|
records = self.db.getRecordset(
|
||||||
Automation2WorkflowRun,
|
AutoRun,
|
||||||
recordFilter={"id": runId},
|
recordFilter={"id": runId},
|
||||||
)
|
)
|
||||||
if not records:
|
if not records:
|
||||||
|
|
@ -345,29 +343,29 @@ class GraphicalEditorObjects:
|
||||||
updates["context"] = context
|
updates["context"] = context
|
||||||
if not updates:
|
if not updates:
|
||||||
return run
|
return run
|
||||||
updated = self.db.recordModify(Automation2WorkflowRun, runId, updates)
|
updated = self.db.recordModify(AutoRun, runId, updates)
|
||||||
return dict(updated)
|
return dict(updated)
|
||||||
|
|
||||||
def getRunsByWorkflow(self, workflowId: str) -> List[Dict[str, Any]]:
|
def getRunsByWorkflow(self, workflowId: str) -> List[Dict[str, Any]]:
|
||||||
"""Get all runs for a workflow."""
|
"""Get all runs for a workflow."""
|
||||||
if not self.db._ensureTableExists(Automation2WorkflowRun):
|
if not self.db._ensureTableExists(AutoRun):
|
||||||
return []
|
return []
|
||||||
records = self.db.getRecordset(
|
records = self.db.getRecordset(
|
||||||
Automation2WorkflowRun,
|
AutoRun,
|
||||||
recordFilter={"workflowId": workflowId},
|
recordFilter={"workflowId": workflowId},
|
||||||
)
|
)
|
||||||
return [dict(r) for r in records] if records else []
|
return [dict(r) for r in records] if records else []
|
||||||
|
|
||||||
def getRecentCompletedRuns(self, limit: int = 20) -> List[Dict[str, Any]]:
|
def getRecentCompletedRuns(self, limit: int = 20) -> List[Dict[str, Any]]:
|
||||||
"""Get recent runs (all statuses) for workflows in this instance."""
|
"""Get recent runs (all statuses) for workflows in this instance."""
|
||||||
if not self.db._ensureTableExists(Automation2WorkflowRun):
|
if not self.db._ensureTableExists(AutoRun):
|
||||||
return []
|
return []
|
||||||
workflows = self.getWorkflows()
|
workflows = self.getWorkflows()
|
||||||
wf_ids = [w["id"] for w in workflows if w.get("id")]
|
wf_ids = [w["id"] for w in workflows if w.get("id")]
|
||||||
if not wf_ids:
|
if not wf_ids:
|
||||||
return []
|
return []
|
||||||
records = self.db.getRecordset(
|
records = self.db.getRecordset(
|
||||||
Automation2WorkflowRun,
|
AutoRun,
|
||||||
recordFilter={},
|
recordFilter={},
|
||||||
)
|
)
|
||||||
if not records:
|
if not records:
|
||||||
|
|
@ -385,10 +383,10 @@ class GraphicalEditorObjects:
|
||||||
|
|
||||||
def getRunsWaitingForEmail(self) -> List[Dict[str, Any]]:
|
def getRunsWaitingForEmail(self) -> List[Dict[str, Any]]:
|
||||||
"""Get all paused runs waiting for a new email (for background poller)."""
|
"""Get all paused runs waiting for a new email (for background poller)."""
|
||||||
if not self.db._ensureTableExists(Automation2WorkflowRun):
|
if not self.db._ensureTableExists(AutoRun):
|
||||||
return []
|
return []
|
||||||
records = self.db.getRecordset(
|
records = self.db.getRecordset(
|
||||||
Automation2WorkflowRun,
|
AutoRun,
|
||||||
recordFilter={"status": "paused"},
|
recordFilter={"status": "paused"},
|
||||||
)
|
)
|
||||||
if not records:
|
if not records:
|
||||||
|
|
@ -426,15 +424,15 @@ class GraphicalEditorObjects:
|
||||||
"status": "pending",
|
"status": "pending",
|
||||||
"result": None,
|
"result": None,
|
||||||
}
|
}
|
||||||
created = self.db.recordCreate(Automation2HumanTask, data)
|
created = self.db.recordCreate(AutoTask, data)
|
||||||
return dict(created)
|
return dict(created)
|
||||||
|
|
||||||
def getTask(self, taskId: str) -> Optional[Dict[str, Any]]:
|
def getTask(self, taskId: str) -> Optional[Dict[str, Any]]:
|
||||||
"""Get a task by ID."""
|
"""Get a task by ID."""
|
||||||
if not self.db._ensureTableExists(Automation2HumanTask):
|
if not self.db._ensureTableExists(AutoTask):
|
||||||
return None
|
return None
|
||||||
records = self.db.getRecordset(
|
records = self.db.getRecordset(
|
||||||
Automation2HumanTask,
|
AutoTask,
|
||||||
recordFilter={"id": taskId},
|
recordFilter={"id": taskId},
|
||||||
)
|
)
|
||||||
if not records:
|
if not records:
|
||||||
|
|
@ -453,7 +451,7 @@ class GraphicalEditorObjects:
|
||||||
updates["result"] = result
|
updates["result"] = result
|
||||||
if not updates:
|
if not updates:
|
||||||
return task
|
return task
|
||||||
updated = self.db.recordModify(Automation2HumanTask, taskId, updates)
|
updated = self.db.recordModify(AutoTask, taskId, updates)
|
||||||
return dict(updated)
|
return dict(updated)
|
||||||
|
|
||||||
def getTasks(
|
def getTasks(
|
||||||
|
|
@ -464,7 +462,7 @@ class GraphicalEditorObjects:
|
||||||
assigneeId: str = None,
|
assigneeId: str = None,
|
||||||
) -> List[Dict[str, Any]]:
|
) -> List[Dict[str, Any]]:
|
||||||
"""Get tasks with optional filters."""
|
"""Get tasks with optional filters."""
|
||||||
if not self.db._ensureTableExists(Automation2HumanTask):
|
if not self.db._ensureTableExists(AutoTask):
|
||||||
return []
|
return []
|
||||||
base_rf: Dict[str, Any] = {}
|
base_rf: Dict[str, Any] = {}
|
||||||
if workflowId:
|
if workflowId:
|
||||||
|
|
@ -476,8 +474,8 @@ class GraphicalEditorObjects:
|
||||||
if assigneeId:
|
if assigneeId:
|
||||||
rf_assigned = {**base_rf, "assigneeId": assigneeId}
|
rf_assigned = {**base_rf, "assigneeId": assigneeId}
|
||||||
rf_unassigned = {**base_rf, "assigneeId": None}
|
rf_unassigned = {**base_rf, "assigneeId": None}
|
||||||
records1 = self.db.getRecordset(Automation2HumanTask, recordFilter=rf_assigned)
|
records1 = self.db.getRecordset(AutoTask, recordFilter=rf_assigned)
|
||||||
records2 = self.db.getRecordset(Automation2HumanTask, recordFilter=rf_unassigned)
|
records2 = self.db.getRecordset(AutoTask, recordFilter=rf_unassigned)
|
||||||
seen = set()
|
seen = set()
|
||||||
items = []
|
items = []
|
||||||
for r in (records1 or []) + (records2 or []):
|
for r in (records1 or []) + (records2 or []):
|
||||||
|
|
@ -488,7 +486,7 @@ class GraphicalEditorObjects:
|
||||||
items.append(rec)
|
items.append(rec)
|
||||||
else:
|
else:
|
||||||
records = self.db.getRecordset(
|
records = self.db.getRecordset(
|
||||||
Automation2HumanTask,
|
AutoTask,
|
||||||
recordFilter=base_rf if base_rf else None,
|
recordFilter=base_rf if base_rf else None,
|
||||||
)
|
)
|
||||||
items = [dict(r) for r in records] if records else []
|
items = [dict(r) for r in records] if records else []
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,7 @@ def _instantiateMethod(methodCls):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("modulePath,className", [
|
@pytest.mark.parametrize("modulePath,className", [
|
||||||
("modules.workflows.methods.methodTrustee.methodTrustee", "MethodTrustee"),
|
("modules.features.trustee.workflows.methodTrustee.methodTrustee", "MethodTrustee"),
|
||||||
("modules.workflows.methods.methodRedmine.methodRedmine", "MethodRedmine"),
|
("modules.workflows.methods.methodRedmine.methodRedmine", "MethodRedmine"),
|
||||||
("modules.workflows.methods.methodSharepoint.methodSharepoint", "MethodSharepoint"),
|
("modules.workflows.methods.methodSharepoint.methodSharepoint", "MethodSharepoint"),
|
||||||
("modules.workflows.methods.methodOutlook.methodOutlook", "MethodOutlook"),
|
("modules.workflows.methods.methodOutlook.methodOutlook", "MethodOutlook"),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue