Skip to content

Commit c682a36

Browse files
authored
add-test-hello-signal (temporalio#28)
1 parent e8e8ee6 commit c682a36

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

tests/hello/hello_signal_test.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import uuid
2+
3+
from temporalio.client import Client, WorkflowExecutionStatus
4+
from temporalio.worker import Worker
5+
6+
from hello.hello_signal import GreetingWorkflow
7+
8+
9+
async def test_signal_workflow(client: Client):
10+
task_queue_name = str(uuid.uuid4())
11+
async with Worker(client, task_queue=task_queue_name, workflows=[GreetingWorkflow]):
12+
handle = await client.start_workflow(
13+
GreetingWorkflow.run, id=str(uuid.uuid4()), task_queue=task_queue_name
14+
)
15+
16+
await handle.signal(GreetingWorkflow.submit_greeting, "user1")
17+
await handle.signal(GreetingWorkflow.submit_greeting, "user2")
18+
assert WorkflowExecutionStatus.RUNNING == (await handle.describe()).status
19+
20+
await handle.signal(GreetingWorkflow.exit)
21+
assert ["Hello, user1", "Hello, user2"] == await handle.result()
22+
assert WorkflowExecutionStatus.COMPLETED == (await handle.describe()).status

0 commit comments

Comments
 (0)