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,
|
||||
AutoStepLog,
|
||||
AutoTask,
|
||||
Automation2Workflow,
|
||||
Automation2WorkflowRun,
|
||||
)
|
||||
from modules.features.graphicalEditor.entryPoints import invocations_synced_with_graph
|
||||
from modules.connectors.connectorDbPostgre import DatabaseConnector
|
||||
|
|
@ -96,11 +94,11 @@ def getAllWorkflowsForScheduling() -> List[Dict[str, Any]]:
|
|||
dbPort=dbPort,
|
||||
userId=None,
|
||||
)
|
||||
if not connector._ensureTableExists(Automation2Workflow):
|
||||
logger.warning("GraphicalEditor schedule: table Automation2Workflow does not exist yet")
|
||||
if not connector._ensureTableExists(AutoWorkflow):
|
||||
logger.warning("GraphicalEditor schedule: table AutoWorkflow does not exist yet")
|
||||
return []
|
||||
records = connector.getRecordset(
|
||||
Automation2Workflow,
|
||||
AutoWorkflow,
|
||||
recordFilter=None,
|
||||
)
|
||||
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]]:
|
||||
"""Get all workflows for this mandate (cross-instance)."""
|
||||
if not self.db._ensureTableExists(Automation2Workflow):
|
||||
if not self.db._ensureTableExists(AutoWorkflow):
|
||||
return []
|
||||
rf: Dict[str, Any] = {
|
||||
"mandateId": self.mandateId,
|
||||
|
|
@ -199,7 +197,7 @@ class GraphicalEditorObjects:
|
|||
if active is not None:
|
||||
rf["active"] = active
|
||||
records = self.db.getRecordset(
|
||||
Automation2Workflow,
|
||||
AutoWorkflow,
|
||||
recordFilter=rf,
|
||||
)
|
||||
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]]:
|
||||
"""Get a single workflow by ID (mandate-scoped, cross-instance)."""
|
||||
if not self.db._ensureTableExists(Automation2Workflow):
|
||||
if not self.db._ensureTableExists(AutoWorkflow):
|
||||
return None
|
||||
records = self.db.getRecordset(
|
||||
Automation2Workflow,
|
||||
AutoWorkflow,
|
||||
recordFilter={
|
||||
"id": workflowId,
|
||||
"mandateId": self.mandateId,
|
||||
|
|
@ -235,7 +233,7 @@ class GraphicalEditorObjects:
|
|||
if "active" not in data or data.get("active") is None:
|
||||
data["active"] = True
|
||||
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["invocations"] = invocations_synced_with_graph(out.get("graph") or {}, out.get("invocations"))
|
||||
try:
|
||||
|
|
@ -258,7 +256,7 @@ class GraphicalEditorObjects:
|
|||
g = {}
|
||||
inv = data["invocations"] if "invocations" in data else existing.get("invocations")
|
||||
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["invocations"] = invocations_synced_with_graph(out.get("graph") or {}, out.get("invocations"))
|
||||
try:
|
||||
|
|
@ -273,7 +271,7 @@ class GraphicalEditorObjects:
|
|||
existing = self.getWorkflow(workflowId)
|
||||
if not existing:
|
||||
return False
|
||||
self.db.recordDelete(Automation2Workflow, workflowId)
|
||||
self.db.recordDelete(AutoWorkflow, workflowId)
|
||||
try:
|
||||
from modules.shared.callbackRegistry import callbackRegistry
|
||||
callbackRegistry.trigger(_CALLBACK_WORKFLOW_CHANGED)
|
||||
|
|
@ -305,15 +303,15 @@ class GraphicalEditorObjects:
|
|||
"mandateId": ctx.get("mandateId") or self.mandateId,
|
||||
"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)
|
||||
|
||||
def getRun(self, runId: str) -> Optional[Dict[str, Any]]:
|
||||
"""Get a run by ID."""
|
||||
if not self.db._ensureTableExists(Automation2WorkflowRun):
|
||||
if not self.db._ensureTableExists(AutoRun):
|
||||
return None
|
||||
records = self.db.getRecordset(
|
||||
Automation2WorkflowRun,
|
||||
AutoRun,
|
||||
recordFilter={"id": runId},
|
||||
)
|
||||
if not records:
|
||||
|
|
@ -345,29 +343,29 @@ class GraphicalEditorObjects:
|
|||
updates["context"] = context
|
||||
if not updates:
|
||||
return run
|
||||
updated = self.db.recordModify(Automation2WorkflowRun, runId, updates)
|
||||
updated = self.db.recordModify(AutoRun, runId, updates)
|
||||
return dict(updated)
|
||||
|
||||
def getRunsByWorkflow(self, workflowId: str) -> List[Dict[str, Any]]:
|
||||
"""Get all runs for a workflow."""
|
||||
if not self.db._ensureTableExists(Automation2WorkflowRun):
|
||||
if not self.db._ensureTableExists(AutoRun):
|
||||
return []
|
||||
records = self.db.getRecordset(
|
||||
Automation2WorkflowRun,
|
||||
AutoRun,
|
||||
recordFilter={"workflowId": workflowId},
|
||||
)
|
||||
return [dict(r) for r in records] if records else []
|
||||
|
||||
def getRecentCompletedRuns(self, limit: int = 20) -> List[Dict[str, Any]]:
|
||||
"""Get recent runs (all statuses) for workflows in this instance."""
|
||||
if not self.db._ensureTableExists(Automation2WorkflowRun):
|
||||
if not self.db._ensureTableExists(AutoRun):
|
||||
return []
|
||||
workflows = self.getWorkflows()
|
||||
wf_ids = [w["id"] for w in workflows if w.get("id")]
|
||||
if not wf_ids:
|
||||
return []
|
||||
records = self.db.getRecordset(
|
||||
Automation2WorkflowRun,
|
||||
AutoRun,
|
||||
recordFilter={},
|
||||
)
|
||||
if not records:
|
||||
|
|
@ -385,10 +383,10 @@ class GraphicalEditorObjects:
|
|||
|
||||
def getRunsWaitingForEmail(self) -> List[Dict[str, Any]]:
|
||||
"""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 []
|
||||
records = self.db.getRecordset(
|
||||
Automation2WorkflowRun,
|
||||
AutoRun,
|
||||
recordFilter={"status": "paused"},
|
||||
)
|
||||
if not records:
|
||||
|
|
@ -426,15 +424,15 @@ class GraphicalEditorObjects:
|
|||
"status": "pending",
|
||||
"result": None,
|
||||
}
|
||||
created = self.db.recordCreate(Automation2HumanTask, data)
|
||||
created = self.db.recordCreate(AutoTask, data)
|
||||
return dict(created)
|
||||
|
||||
def getTask(self, taskId: str) -> Optional[Dict[str, Any]]:
|
||||
"""Get a task by ID."""
|
||||
if not self.db._ensureTableExists(Automation2HumanTask):
|
||||
if not self.db._ensureTableExists(AutoTask):
|
||||
return None
|
||||
records = self.db.getRecordset(
|
||||
Automation2HumanTask,
|
||||
AutoTask,
|
||||
recordFilter={"id": taskId},
|
||||
)
|
||||
if not records:
|
||||
|
|
@ -453,7 +451,7 @@ class GraphicalEditorObjects:
|
|||
updates["result"] = result
|
||||
if not updates:
|
||||
return task
|
||||
updated = self.db.recordModify(Automation2HumanTask, taskId, updates)
|
||||
updated = self.db.recordModify(AutoTask, taskId, updates)
|
||||
return dict(updated)
|
||||
|
||||
def getTasks(
|
||||
|
|
@ -464,7 +462,7 @@ class GraphicalEditorObjects:
|
|||
assigneeId: str = None,
|
||||
) -> List[Dict[str, Any]]:
|
||||
"""Get tasks with optional filters."""
|
||||
if not self.db._ensureTableExists(Automation2HumanTask):
|
||||
if not self.db._ensureTableExists(AutoTask):
|
||||
return []
|
||||
base_rf: Dict[str, Any] = {}
|
||||
if workflowId:
|
||||
|
|
@ -476,8 +474,8 @@ class GraphicalEditorObjects:
|
|||
if assigneeId:
|
||||
rf_assigned = {**base_rf, "assigneeId": assigneeId}
|
||||
rf_unassigned = {**base_rf, "assigneeId": None}
|
||||
records1 = self.db.getRecordset(Automation2HumanTask, recordFilter=rf_assigned)
|
||||
records2 = self.db.getRecordset(Automation2HumanTask, recordFilter=rf_unassigned)
|
||||
records1 = self.db.getRecordset(AutoTask, recordFilter=rf_assigned)
|
||||
records2 = self.db.getRecordset(AutoTask, recordFilter=rf_unassigned)
|
||||
seen = set()
|
||||
items = []
|
||||
for r in (records1 or []) + (records2 or []):
|
||||
|
|
@ -488,7 +486,7 @@ class GraphicalEditorObjects:
|
|||
items.append(rec)
|
||||
else:
|
||||
records = self.db.getRecordset(
|
||||
Automation2HumanTask,
|
||||
AutoTask,
|
||||
recordFilter=base_rf if base_rf else None,
|
||||
)
|
||||
items = [dict(r) for r in records] if records else []
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ def _instantiateMethod(methodCls):
|
|||
|
||||
|
||||
@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.methodSharepoint.methodSharepoint", "MethodSharepoint"),
|
||||
("modules.workflows.methods.methodOutlook.methodOutlook", "MethodOutlook"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue