@@ -51,6 +51,57 @@ def test_start_returns_sync_handle(self) -> None:
5151 assert handle .workflow_id == "wf-1"
5252 assert handle .run_id == "run-1"
5353
54+ def test_priority_and_fairness_are_forwarded_on_start (self ) -> None :
55+ client = Client ("http://localhost:8080" )
56+ resp = _mock_response (
57+ 201 ,
58+ {
59+ "workflow_id" : "wf-prio" ,
60+ "run_id" : "run-prio" ,
61+ "workflow_type" : "greeter" ,
62+ },
63+ )
64+ with patch .object (
65+ client ._async ._http , "request" , new_callable = AsyncMock , return_value = resp
66+ ) as mock :
67+ client .start_workflow (
68+ workflow_type = "greeter" ,
69+ task_queue = "shared" ,
70+ workflow_id = "wf-prio" ,
71+ priority = 1 ,
72+ fairness_key = "tenant-a" ,
73+ fairness_weight = 3 ,
74+ )
75+
76+ body = mock .call_args .kwargs .get ("json" ) or mock .call_args [1 ].get ("json" )
77+ assert body ["priority" ] == 1
78+ assert body ["fairness_key" ] == "tenant-a"
79+ assert body ["fairness_weight" ] == 3
80+
81+ def test_priority_and_fairness_are_omitted_when_unset (self ) -> None :
82+ client = Client ("http://localhost:8080" )
83+ resp = _mock_response (
84+ 201 ,
85+ {
86+ "workflow_id" : "wf-nopri" ,
87+ "run_id" : "run-nopri" ,
88+ "workflow_type" : "greeter" ,
89+ },
90+ )
91+ with patch .object (
92+ client ._async ._http , "request" , new_callable = AsyncMock , return_value = resp
93+ ) as mock :
94+ client .start_workflow (
95+ workflow_type = "greeter" ,
96+ task_queue = "shared" ,
97+ workflow_id = "wf-nopri" ,
98+ )
99+
100+ body = mock .call_args .kwargs .get ("json" ) or mock .call_args [1 ].get ("json" )
101+ assert "priority" not in body
102+ assert "fairness_key" not in body
103+ assert "fairness_weight" not in body
104+
54105
55106class TestSyncClientDescribe :
56107 def test_describe (self ) -> None :
0 commit comments