@@ -99,7 +99,12 @@ async def test_submit_patch_creates_planned_changes_revision(monkeypatch):
9999 )
100100
101101 result = await phabricator_handler .SubmitPatchHandler ().apply (
102- {"bug_id" : 1 , "title" : "Fix" , "summary" : "s" },
102+ {
103+ "bug_id" : 1 ,
104+ "title" : "Fix" ,
105+ "summary" : "s" ,
106+ "test_plan" : "uv run pytest (passed)" ,
107+ },
103108 _ctx (),
104109 )
105110
@@ -124,6 +129,31 @@ async def test_submit_patch_creates_planned_changes_revision(monkeypatch):
124129 assert "reviewers.add" not in transactions
125130 assert transactions ["bugzilla.bug-id" ] == "1"
126131 assert transactions ["summary" ] == "s"
132+ assert transactions ["testPlan" ] == "uv run pytest (passed)"
133+
134+
135+ async def test_submit_patch_accepts_legacy_action_without_test_plan (monkeypatch ):
136+ fake , calls = _fake_conduit (
137+ {
138+ "differential.creatediff" : {"phid" : "PHID-DIFF-1" , "diffid" : 1 },
139+ "differential.revision.edit" : {"object" : {"id" : 555 }},
140+ "differential.setdiffproperty" : {},
141+ }
142+ )
143+ monkeypatch .setattr (phabricator_handler , "_conduit_request" , fake )
144+ monkeypatch .setattr (
145+ phabricator_handler , "_repository_phid" , AsyncMock (return_value = "PHID-REPO-1" )
146+ )
147+
148+ result = await phabricator_handler .SubmitPatchHandler ().apply (
149+ {"bug_id" : 1 , "title" : "Fix" , "summary" : "s" },
150+ _ctx (),
151+ )
152+
153+ assert result .status == "applied"
154+ edit_call = next (c for c in calls if c [0 ] == "differential.revision.edit" )
155+ transaction_types = {t ["type" ] for t in edit_call [1 ]["transactions" ]}
156+ assert "testPlan" not in transaction_types
127157
128158
129159async def test_submit_patch_sets_local_commits_property (monkeypatch ):
@@ -150,7 +180,12 @@ async def test_submit_patch_sets_local_commits_property(monkeypatch):
150180 "tree" : "tree1" ,
151181 }
152182 result = await phabricator_handler .SubmitPatchHandler ().apply (
153- {"bug_id" : 5 , "title" : "Fix the thing" , "summary" : "does it" },
183+ {
184+ "bug_id" : 5 ,
185+ "title" : "Fix the thing" ,
186+ "summary" : "does it" ,
187+ "test_plan" : "uv run pytest tests/test_thing.py (passed)" ,
188+ },
154189 _ctx (local_commits = {"node1" : dict (git_fields )}),
155190 )
156191 assert result .status == "applied"
@@ -173,6 +208,7 @@ async def test_submit_patch_sets_local_commits_property(monkeypatch):
173208 # The stored title matches the visible revision title and reviewers are empty.
174209 assert stored ["summary" ] == "Fix the thing"
175210 assert stored ["message" ].startswith ("Fix the thing\n \n Summary:\n does it" )
211+ assert "Test Plan:\n uv run pytest tests/test_thing.py (passed)" in stored ["message" ]
176212 assert (
177213 "Differential Revision: https://phabricator.services.mozilla.com/D77"
178214 in stored ["message" ]
@@ -228,6 +264,7 @@ async def test_update_patch_local_commits_use_the_revisions_own_fields(monkeypat
228264 "fields" : {
229265 "title" : "WIP: Existing title" ,
230266 "summary" : "old sum" ,
267+ "testPlan" : "existing test plan" ,
231268 "bugzilla.bug-id" : "9" ,
232269 }
233270 }
@@ -254,6 +291,7 @@ async def test_update_patch_local_commits_use_the_revisions_own_fields(monkeypat
254291 )["n" ]
255292 assert stored ["summary" ] == "WIP: Existing title"
256293 assert stored ["message" ].startswith ("WIP: Existing title\n \n Summary:\n old sum" )
294+ assert "Test Plan:\n existing test plan" in stored ["message" ]
257295 assert "Bug #: 9" in stored ["message" ]
258296 assert (
259297 "Differential Revision: https://phabricator.services.mozilla.com/D42"
0 commit comments