fix: target label delete and move helpers before entry point

This commit is contained in:
2026-07-02 05:55:29 -04:00
parent 4afada098c
commit b3728c54ce
2 changed files with 81 additions and 78 deletions
+13 -18
View File
@@ -1377,9 +1377,8 @@ class TestTrackerHygieneCleanup(unittest.TestCase):
return [{"name": "status:in-progress", "id": 1}, {"name": "bug", "id": 2}]
if method == "GET" and "issues/1" in url:
return {"labels": [{"name": "status:in-progress"}, {"name": "bug"}]}
if method == "PUT" and "labels" in url:
self.assertEqual(payload["labels"], [2])
return []
if method == "DELETE" and "labels/1" in url:
return {}
return {}
self.mock_api.side_effect = api_side_effect
@@ -1396,8 +1395,8 @@ class TestTrackerHygieneCleanup(unittest.TestCase):
return [{"name": "status:in-progress", "id": 1}, {"name": "bug", "id": 2}]
if method == "GET" and "issues/1" in url:
return {"labels": [{"name": "bug"}]}
if method == "PUT" and "labels" in url:
self.fail("Should not PUT labels")
if method == "DELETE" and "labels/1" in url:
self.fail("Should not DELETE labels")
return {}
self.mock_api.side_effect = api_side_effect
@@ -1426,9 +1425,8 @@ class TestTrackerHygieneCleanup(unittest.TestCase):
return [{"name": "status:in-progress", "id": 1}, {"name": "bug", "id": 2}]
if method == "GET" and "issues/123" in url:
return {"labels": [{"name": "status:in-progress"}, {"name": "bug"}]}
if method == "PUT" and "labels" in url:
self.assertEqual(payload["labels"], [2])
return []
if method == "DELETE" and "labels/1" in url:
return {}
return {}
self.mock_api.side_effect = api_side_effect
@@ -1457,9 +1455,8 @@ class TestTrackerHygieneCleanup(unittest.TestCase):
return [{"name": "status:in-progress", "id": 1}, {"name": "bug", "id": 2}]
if method == "GET" and "issues/123" in url:
return {"labels": [{"name": "status:in-progress"}, {"name": "bug"}]}
if method == "PUT" and "labels" in url:
self.assertEqual(payload["labels"], [2])
return []
if method == "DELETE" and "labels/1" in url:
return {}
return {}
self.mock_api.side_effect = api_side_effect
@@ -1482,9 +1479,8 @@ class TestTrackerHygieneCleanup(unittest.TestCase):
return [{"name": "status:in-progress", "id": 1}]
if method == "GET" and "issues/123" in url:
return {"labels": [{"name": "status:in-progress"}]}
if method == "PUT" and "labels" in url:
self.assertEqual(payload["labels"], [])
return []
if method == "DELETE" and "labels/1" in url:
return {}
if method == "POST" and "comments" in url:
return {}
return {}
@@ -1513,9 +1509,8 @@ class TestTrackerHygieneCleanup(unittest.TestCase):
return {"labels": [{"name": "status:in-progress"}]}
if method == "GET" and "issues/125" in url:
return {"labels": []}
if method == "PUT" and "labels" in url:
self.assertEqual(payload["labels"], [])
return []
if method == "DELETE" and "labels/1" in url:
return {}
if method == "POST" and "comments" in url:
return {}
return {}
@@ -1553,7 +1548,7 @@ class TestTrackerHygieneCleanup(unittest.TestCase):
return [{"name": "status:in-progress", "id": 1}]
if method == "GET" and "issues/1" in url:
return {"labels": [{"name": "status:in-progress"}]}
if method == "PUT" and "labels" in url:
if method == "DELETE" and "labels/1" in url:
raise RuntimeError("API failure")
return {}
self.mock_api.side_effect = api_side_effect