27
27
pytestmark = pytest .mark .flaky_github
28
28
29
29
30
- @pytest .fixture
31
- def sync_labels_fn (mocker ):
32
- """A patch on synchronize_labels"""
33
- return mocker .patch ("openedx_webhooks.tasks.github_work.synchronize_labels" )
34
-
35
30
def close_and_reopen_pr (pr ):
36
31
"""For testing re-opening, close the pr, process it, then re-open it."""
37
32
pr .close (merge = False )
@@ -96,7 +91,7 @@ def test_pr_opened_by_bot(fake_github, fake_jira):
96
91
assert pull_request_projects (pr .as_json ()) == set ()
97
92
98
93
99
- def test_external_pr_opened_no_cla (has_jira , sync_labels_fn , fake_github , fake_jira ):
94
+ def test_external_pr_opened_no_cla (has_jira , fake_github , fake_jira ):
100
95
# No CLA, because this person is not in people.yaml
101
96
fake_github .make_user (login = "new_contributor" , name = "Newb Contributor" )
102
97
pr = fake_github .make_pull_request (owner = "openedx" , repo = "edx-platform" , user = "new_contributor" )
@@ -128,9 +123,6 @@ def test_external_pr_opened_no_cla(has_jira, sync_labels_fn, fake_github, fake_j
128
123
assert issue_id is None
129
124
assert len (fake_jira .issues ) == 0
130
125
131
- # Check that we synchronized labels.
132
- sync_labels_fn .assert_called_once_with ("openedx/edx-platform" )
133
-
134
126
# Check the GitHub comment that was created.
135
127
pr_comments = pr .list_comments ()
136
128
assert len (pr_comments ) == 1
@@ -167,7 +159,7 @@ def test_external_pr_opened_no_cla(has_jira, sync_labels_fn, fake_github, fake_j
167
159
assert len (fake_jira .issues ) == 0
168
160
169
161
170
- def test_external_pr_opened_with_cla (has_jira , sync_labels_fn , fake_github , fake_jira ):
162
+ def test_external_pr_opened_with_cla (has_jira , fake_github , fake_jira ):
171
163
pr = fake_github .make_pull_request (owner = "openedx" , repo = "some-code" , user = "tusbar" , number = 11235 )
172
164
prj = pr .as_json ()
173
165
@@ -197,9 +189,6 @@ def test_external_pr_opened_with_cla(has_jira, sync_labels_fn, fake_github, fake
197
189
assert issue_id is None
198
190
assert len (fake_jira .issues ) == 0
199
191
200
- # Check that we synchronized labels.
201
- sync_labels_fn .assert_called_once_with ("openedx/some-code" )
202
-
203
192
# Check the GitHub comment that was created.
204
193
pr_comments = pr .list_comments ()
205
194
assert len (pr_comments ) == 1
@@ -238,7 +227,7 @@ def test_external_pr_opened_with_cla(has_jira, sync_labels_fn, fake_github, fake
238
227
assert len (fake_jira .issues ) == 0
239
228
240
229
241
- def test_psycho_reopening (sync_labels_fn , fake_github , fake_jira ):
230
+ def test_psycho_reopening (fake_github , fake_jira ):
242
231
# Check that close/re-open/close/re-open etc will properly track the jira status.
243
232
pr = fake_github .make_pull_request (owner = "openedx" , repo = "some-code" , user = "tusbar" , number = 11235 )
244
233
prj = pr .as_json ()
@@ -257,7 +246,7 @@ def test_psycho_reopening(sync_labels_fn, fake_github, fake_jira):
257
246
assert issue .status == status
258
247
259
248
260
- def test_core_committer_pr_opened (has_jira , sync_labels_fn , fake_github , fake_jira ):
249
+ def test_core_committer_pr_opened (has_jira , fake_github , fake_jira ):
261
250
pr = fake_github .make_pull_request (user = "felipemontoya" , owner = "openedx" , repo = "edx-platform" )
262
251
prj = pr .as_json ()
263
252
@@ -287,9 +276,6 @@ def test_core_committer_pr_opened(has_jira, sync_labels_fn, fake_github, fake_ji
287
276
assert issue_id is None
288
277
assert len (fake_jira .issues ) == 0
289
278
290
- # Check that we synchronized labels.
291
- sync_labels_fn .assert_called_once_with ("openedx/edx-platform" )
292
-
293
279
# Check the GitHub comment that was created.
294
280
pr_comments = pr .list_comments ()
295
281
assert len (pr_comments ) == 1
@@ -311,7 +297,7 @@ def test_core_committer_pr_opened(has_jira, sync_labels_fn, fake_github, fake_ji
311
297
assert pull_request_projects (pr .as_json ()) == {settings .GITHUB_OSPR_PROJECT }
312
298
313
299
314
- def test_old_core_committer_pr_opened (sync_labels_fn , fake_github , fake_jira ):
300
+ def test_old_core_committer_pr_opened (fake_github , fake_jira ):
315
301
# No-one was a core committer before June 2020.
316
302
# This test only asserts the core-committer things, that they are not cc.
317
303
pr = fake_github .make_pull_request (
@@ -356,7 +342,7 @@ def test_old_core_committer_pr_opened(sync_labels_fn, fake_github, fake_jira):
356
342
pytest .param (False , id = "epic:no" ),
357
343
pytest .param (True , id = "epic:yes" ),
358
344
])
359
- def test_blended_pr_opened_with_cla (with_epic , has_jira , sync_labels_fn , fake_github , fake_jira ):
345
+ def test_blended_pr_opened_with_cla (with_epic , has_jira , fake_github , fake_jira ):
360
346
pr = fake_github .make_pull_request (owner = "openedx" , repo = "some-code" , user = "tusbar" , title = "[BD-34] Something good" )
361
347
prj = pr .as_json ()
362
348
total_issues = 0
@@ -401,9 +387,6 @@ def test_blended_pr_opened_with_cla(with_epic, has_jira, sync_labels_fn, fake_gi
401
387
assert issue_id is None
402
388
assert len (fake_jira .issues ) == total_issues
403
389
404
- # Check that we synchronized labels.
405
- sync_labels_fn .assert_called_once_with ("openedx/some-code" )
406
-
407
390
# Check the GitHub comment that was created.
408
391
pr_comments = pr .list_comments ()
409
392
assert len (pr_comments ) == 1
@@ -825,7 +808,7 @@ def test_draft_pr_opened(pr_type, jira_got_fiddled, has_jira, fake_github, fake_
825
808
assert initial_status .lower () in pr .labels
826
809
827
810
828
- def test_handle_closed_pr (is_merged , has_jira , sync_labels_fn , fake_github , fake_jira ):
811
+ def test_handle_closed_pr (is_merged , has_jira , fake_github , fake_jira ):
829
812
pr = fake_github .make_pull_request (user = "tusbar" , number = 11237 , state = "closed" , merged = is_merged )
830
813
prj = pr .as_json ()
831
814
issue_id1 , anything_happened = pull_request_changed (prj )
0 commit comments