Skip to content

Commit bffd8a8

Browse files
fix: Patch _find_reviewed_revisions_by_sha1 at correct module path
1 parent c3bf8b1 commit bffd8a8

3 files changed

Lines changed: 34 additions & 298 deletions

File tree

MYPY_IMPROVEMENT_PLAN.md

Lines changed: 0 additions & 295 deletions
This file was deleted.

app/reviews/tests/test_revert_detection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def test_find_reviewed_revisions_by_sha1_no_results(self, mock_superset):
139139

140140
self.assertEqual(reviewed_revisions, [])
141141

142-
@patch("reviews.autoreview._find_reviewed_revisions_by_sha1")
142+
@patch("reviews.autoreview.checks.revert_detection._find_reviewed_revisions_by_sha1")
143143
def test_revert_detection_approve(self, mock_find_reviewed):
144144
"""Test revert detection when revert to reviewed content is found."""
145145
# Mock finding reviewed revisions
@@ -153,7 +153,7 @@ def test_revert_detection_approve(self, mock_find_reviewed):
153153
self.assertIn("Revert to previously reviewed content", result["message"])
154154
self.assertIn("abc123", result["message"])
155155

156-
@patch("reviews.autoreview._find_reviewed_revisions_by_sha1")
156+
@patch("reviews.autoreview.checks.revert_detection._find_reviewed_revisions_by_sha1")
157157
def test_revert_detection_block(self, mock_find_reviewed):
158158
"""Test revert detection when no reviewed content is found."""
159159
# Mock no reviewed revisions found
@@ -178,7 +178,7 @@ def test_revert_detection_no_reverted_ids(self):
178178

179179
def test_revert_detection_metadata(self):
180180
"""Test that revert detection returns proper metadata."""
181-
with patch("reviews.autoreview._find_reviewed_revisions_by_sha1") as mock_find:
181+
with patch("reviews.autoreview.checks.revert_detection._find_reviewed_revisions_by_sha1") as mock_find:
182182
mock_find.return_value = [{"sha1": "abc123"}]
183183

184184
result = _check_revert_detection(self.revision, self.client)

tatus --short

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
diff --git a/app/reviews/tests/test_revert_detection.py b/app/reviews/tests/test_revert_detection.py
2+
index 8d4f651..863d811 100644
3+
--- a/app/reviews/tests/test_revert_detection.py
4+
+++ b/app/reviews/tests/test_revert_detection.py
5+
@@ -139,7 +139,7 @@ class RevertDetectionTests(TestCase):
6+

7+
self.assertEqual(reviewed_revisions, [])
8+

9+
- @patch("reviews.autoreview._find_reviewed_revisions_by_sha1")
10+
+ @patch("reviews.autoreview.checks.revert_detection._find_reviewed_revisions_by_sha1")
11+
def test_revert_detection_approve(self, mock_find_reviewed):
12+
"""Test revert detection when revert to reviewed content is found."""
13+
# Mock finding reviewed revisions
14+
@@ -153,7 +153,7 @@ class RevertDetectionTests(TestCase):
15+
self.assertIn("Revert to previously reviewed content", result["message"])
16+
self.assertIn("abc123", result["message"])
17+

18+
- @patch("reviews.autoreview._find_reviewed_revisions_by_sha1")
19+
+ @patch("reviews.autoreview.checks.revert_detection._find_reviewed_revisions_by_sha1")
20+
def test_revert_detection_block(self, mock_find_reviewed):
21+
"""Test revert detection when no reviewed content is found."""
22+
# Mock no reviewed revisions found
23+
@@ -178,7 +178,7 @@ class RevertDetectionTests(TestCase):
24+

25+
def test_revert_detection_metadata(self):
26+
"""Test that revert detection returns proper metadata."""
27+
- with patch("reviews.autoreview._find_reviewed_revisions_by_sha1") as mock_find:
28+
+ with patch("reviews.autoreview.checks.revert_detection._find_reviewed_revisions_by_sha1") as mock_find:
29+
mock_find.return_value = [{"sha1": "abc123"}]
30+

31+
result = _check_revert_detection(self.revision, self.client)

0 commit comments

Comments
 (0)