Skip to content

Commit b2eb8d1

Browse files
fix(workflow): set entry to workflow stage before publish_request_approval
publish_request_approval calls GET /workflow which returns 401 when the entry has no active workflow state. wf_entry is class-scoped so TestWorkflowPublishRules gets a fresh entry that was never assigned to a stage (TestWorkflowStagesAndTasks sets a different instance). Fix: call set_workflow_stage inside the test to activate the entry's workflow state before querying. Removes the xfail marker.
1 parent c0ca20c commit b2eb8d1

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

tests/integration/api/test_21_workflow.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,16 @@ def test_delete_publish_rule(self, stack, store):
185185
resp = stack.workflows().delete_publish_rule(rule_uid)
186186
h.assert_status(resp, 200)
187187

188-
@pytest.mark.xfail(reason="publish_request_approval returns 401 — the test account "
189-
"lacks publish-approval permission on a fresh stack", strict=False)
190-
def test_publish_request_approval(self, stack, content_type_uid, wf_entry):
188+
def test_publish_request_approval(self, stack, content_type_uid, wf_entry, wf_stage_uid):
191189
if not wf_entry:
192190
pytest.skip("entry not available")
191+
# wf_entry is class-scoped so this class gets a fresh entry that was never
192+
# assigned to a workflow stage. Assign it first so the GET /workflow endpoint
193+
# returns 200 instead of 401 (no active workflow state).
194+
if wf_stage_uid:
195+
stage_data = {"workflow": {"workflow_stage": {"comment": "approval test", "uid": wf_stage_uid, "notify": False}}}
196+
stack.workflows().set_workflow_stage(content_type_uid, wf_entry, stage_data)
197+
h.wait(h.SHORT_DELAY)
193198
resp = stack.workflows().publish_request_approval(content_type_uid, wf_entry)
194199
h.assert_status(resp, 200, 201)
195200

0 commit comments

Comments
 (0)