Skip to content

Commit 276aaf7

Browse files
authored
adds test example for hello_update.py (#118)
1 parent ba5fd0f commit 276aaf7

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Diff for: tests/hello/hello_update_test.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import uuid
2+
3+
import pytest
4+
from temporalio.client import Client, WorkflowExecutionStatus
5+
from temporalio.testing import WorkflowEnvironment
6+
from temporalio.worker import Worker
7+
8+
from hello.hello_update import GreetingWorkflow
9+
10+
11+
async def test_update_workflow(client: Client, env: WorkflowEnvironment):
12+
if env.supports_time_skipping:
13+
pytest.skip(
14+
"Time-skipping test server currently has issue with update: https://github.com/temporalio/sdk-java/issues/1903"
15+
)
16+
task_queue_name = str(uuid.uuid4())
17+
async with Worker(client, task_queue=task_queue_name, workflows=[GreetingWorkflow]):
18+
handle = await client.start_workflow(
19+
GreetingWorkflow.run, id=str(uuid.uuid4()), task_queue=task_queue_name
20+
)
21+
22+
assert WorkflowExecutionStatus.RUNNING == (await handle.describe()).status
23+
24+
update_result = await handle.execute_update(
25+
GreetingWorkflow.update_workflow_status
26+
)
27+
assert "Workflow status updated" == update_result
28+
assert "Hello, World!" == (await handle.result())
29+
assert WorkflowExecutionStatus.COMPLETED == (await handle.describe()).status

0 commit comments

Comments
 (0)