@@ -82,6 +82,9 @@ def approved(login="instance", commit=SHA):
8282 "quote_only" : ([STOP , later ("> STOPP aufgehoben" )], [], True ),
8383 "fenced_formula" : ([STOP , later ("```\n STOPP aufgehoben\n ```" )], [], True ),
8484 "tilde_fenced_formula" : ([STOP , later ("~~~text\n STOPP aufgehoben\n ~~~" )], [], True ),
85+ # 0.2.2: an indented code block shows the formula instead of saying it
86+ "indented_code_formula" : ([STOP , later ("Beispiel:\n \n STOPP aufgehoben" )], [], True ),
87+ "tab_indented_formula" : ([STOP , later ("\t Merge freigegeben" )], [], True ),
8588 # lifts
8689 "release_after_closed_fence" : ([STOP , later ("```\n log\n ```\n STOPP aufgehoben" )], [], False ),
8790 "release_own_line" : ([STOP , later ("Nachmessung grün.\n STOPP aufgehoben" )], [], False ),
@@ -219,6 +222,42 @@ def test_without_stop_signal_merge_and_approve_proceed():
219222 assert approve (Transport (plain ))["receipts" ][0 ]["status" ] == "applied"
220223
221224
225+ FORMULA = "Nachmessung grün.\n STOPP aufgehoben"
226+ WRITES = [
227+ ("issue.comment" , {"repo" : REPO , "number" : 7 , "body" : FORMULA }),
228+ ("pr.review" , {"repo" : REPO , "number" : 7 , "sha" : SHA , "event" : "COMMENT" , "body" : FORMULA }),
229+ ("api.request" , {"method" : "POST" , "endpoint" : f"repos/{ REPO } /issues/7/comments" , "body" : {"body" : FORMULA }}),
230+ ("api.request" , {"method" : "POST" , "endpoint" : f"/repos/{ REPO } /pulls/7/reviews/" , "body" : {"body" : FORMULA }}),
231+ ]
232+
233+
234+ def fallback_config (** multi_bot ):
235+ layer = {
236+ "permissions" : {"enabled" : ["issue.comment" , "pr.review" , "api.request" ], "write_owners" : ["example-org" ]},
237+ "multi_bot" : {"merge_account" : "owner-account" , "policy" : {"publish_reviews" : True }, ** multi_bot },
238+ }
239+ return merge_layers ([("default" , default_config ()), ("instance" , layer )])
240+
241+
242+ @pytest .mark .parametrize ("kind,params" , WRITES )
243+ def test_bot_under_owner_account_never_posts_a_release_line (kind , params ):
244+ for cfg in (
245+ fallback_config (owner_fallback = True ),
246+ fallback_config (policy = {"publish_reviews" : True , "stop_release_accounts" : ["Owner-Account" ]}),
247+ ):
248+ assert "release line" in (stop_gate .write_denial (kind , params , cfg ) or "" )
249+ assert "release line" in (actions .denial_reason (Action (kind , params ), cfg ) or "" )
250+
251+
252+ def test_release_lines_stay_allowed_outside_the_owner_fallback ():
253+ for kind , params in WRITES :
254+ assert stop_gate .write_denial (kind , params , fallback_config ()) is None
255+ quoted = {"repo" : REPO , "number" : 7 , "body" : "> STOPP aufgehoben\n \n Noch offen." }
256+ assert stop_gate .write_denial ("issue.comment" , quoted , fallback_config (owner_fallback = True )) is None
257+ labels = {"repo" : REPO , "number" : 7 , "labels" : ["STOPP aufgehoben" ]}
258+ assert stop_gate .write_denial ("issue.add_labels" , labels , fallback_config (owner_fallback = True )) is None
259+
260+
222261@pytest .mark .parametrize ("endpoint" , [COMMENTS , INLINE , REVIEWS ])
223262def test_unreadable_lists_fail_closed (endpoint ):
224263 transport = Transport (PROMPTBOARD_8 )
0 commit comments