resolve conflicts for PR #461
This commit is contained in:
+20
-15
@@ -3087,8 +3087,9 @@ class TestIssueLocking(unittest.TestCase):
|
|||||||
"mcp_server.issue_lock_worktree.read_worktree_git_state",
|
"mcp_server.issue_lock_worktree.read_worktree_git_state",
|
||||||
return_value=_clean_master_git_state_for_lock(),
|
return_value=_clean_master_git_state_for_lock(),
|
||||||
)
|
)
|
||||||
|
@patch("mcp_server.api_get_all", return_value=[])
|
||||||
@patch("mcp_server.get_auth_header", return_value=FAKE_AUTH)
|
@patch("mcp_server.get_auth_header", return_value=FAKE_AUTH)
|
||||||
def test_lock_issue_success(self, _auth, _git_state):
|
def test_lock_issue_success(self, _auth, _api, _git_state):
|
||||||
res = gitea_lock_issue(issue_number=196, branch_name="feat/issue-196-mutations", remote="prgs")
|
res = gitea_lock_issue(issue_number=196, branch_name="feat/issue-196-mutations", remote="prgs")
|
||||||
self.assertTrue(res["success"])
|
self.assertTrue(res["success"])
|
||||||
self.assertEqual(res["work_lease"]["operation_type"], "author_issue_work")
|
self.assertEqual(res["work_lease"]["operation_type"], "author_issue_work")
|
||||||
@@ -3193,28 +3194,20 @@ class TestIssueLocking(unittest.TestCase):
|
|||||||
"mcp_server.issue_lock_worktree.read_worktree_git_state",
|
"mcp_server.issue_lock_worktree.read_worktree_git_state",
|
||||||
return_value=_clean_master_git_state_for_lock(),
|
return_value=_clean_master_git_state_for_lock(),
|
||||||
)
|
)
|
||||||
@patch("mcp_server.api_get_all")
|
|
||||||
@patch("mcp_server.get_auth_header", return_value=FAKE_AUTH)
|
@patch("mcp_server.get_auth_header", return_value=FAKE_AUTH)
|
||||||
def test_lock_issue_open_pr_blocks_adoption(self, _auth, mock_api, _git_state):
|
def test_lock_issue_open_pr_blocks_adoption(self, _auth, _git_state):
|
||||||
# Even with the exact own branch present, an open PR blocks adoption.
|
# Even with the exact own branch present, an open PR blocks adoption.
|
||||||
def _api(url, *a, **k):
|
self.mock_dup_fetcher.return_value = ([{
|
||||||
if "/pulls" in url:
|
|
||||||
return [{
|
|
||||||
"number": 200,
|
"number": 200,
|
||||||
"head": {"ref": "feat/issue-196-mutations"},
|
"head": {"ref": "feat/issue-196-mutations"},
|
||||||
"title": "WIP",
|
"title": "WIP",
|
||||||
"body": "",
|
"body": "",
|
||||||
}]
|
}], ["feat/issue-196-mutations"], {"status": "not_claimed"})
|
||||||
if "/branches" in url:
|
|
||||||
return [{"name": "feat/issue-196-mutations", "commit": {"id": "abc"}}]
|
|
||||||
return []
|
|
||||||
|
|
||||||
mock_api.side_effect = _api
|
|
||||||
with self.assertRaises(ValueError) as ctx:
|
with self.assertRaises(ValueError) as ctx:
|
||||||
gitea_lock_issue(
|
gitea_lock_issue(
|
||||||
issue_number=196, branch_name="feat/issue-196-mutations", remote="prgs"
|
issue_number=196, branch_name="feat/issue-196-mutations", remote="prgs"
|
||||||
)
|
)
|
||||||
self.assertIn("already tied to an open PR", str(ctx.exception))
|
self.assertIn("open PR #200 already covers issue", str(ctx.exception))
|
||||||
self.assertFalse(os.path.exists(ISSUE_LOCK_FILE))
|
self.assertFalse(os.path.exists(ISSUE_LOCK_FILE))
|
||||||
|
|
||||||
@patch("mcp_server.role_session_router.check_author_mutation_after_reviewer_stop",
|
@patch("mcp_server.role_session_router.check_author_mutation_after_reviewer_stop",
|
||||||
@@ -3255,7 +3248,13 @@ class TestIssueLocking(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
self.assertEqual(pr["number"], 7)
|
self.assertEqual(pr["number"], 7)
|
||||||
|
|
||||||
def test_lock_issue_blocks_active_same_operation_lease(self):
|
@patch(
|
||||||
|
"mcp_server.issue_lock_worktree.read_worktree_git_state",
|
||||||
|
return_value=_clean_master_git_state_for_lock(),
|
||||||
|
)
|
||||||
|
@patch("mcp_server.api_get_all", return_value=[])
|
||||||
|
@patch("mcp_server.get_auth_header", return_value=FAKE_AUTH)
|
||||||
|
def test_lock_issue_blocks_active_same_operation_lease(self, _auth, _api, _git_state):
|
||||||
with open(ISSUE_LOCK_FILE, "w", encoding="utf-8") as f:
|
with open(ISSUE_LOCK_FILE, "w", encoding="utf-8") as f:
|
||||||
json.dump({
|
json.dump({
|
||||||
"issue_number": 196,
|
"issue_number": 196,
|
||||||
@@ -3270,7 +3269,13 @@ class TestIssueLocking(unittest.TestCase):
|
|||||||
gitea_lock_issue(issue_number=196, branch_name="feat/issue-196-mutations", remote="prgs")
|
gitea_lock_issue(issue_number=196, branch_name="feat/issue-196-mutations", remote="prgs")
|
||||||
self.assertIn("already has an active author_issue_work lease", str(ctx.exception))
|
self.assertIn("already has an active author_issue_work lease", str(ctx.exception))
|
||||||
|
|
||||||
def test_lock_issue_blocks_expired_same_operation_lease_for_recovery(self):
|
@patch(
|
||||||
|
"mcp_server.issue_lock_worktree.read_worktree_git_state",
|
||||||
|
return_value=_clean_master_git_state_for_lock(),
|
||||||
|
)
|
||||||
|
@patch("mcp_server.api_get_all", return_value=[])
|
||||||
|
@patch("mcp_server.get_auth_header", return_value=FAKE_AUTH)
|
||||||
|
def test_lock_issue_blocks_expired_same_operation_lease_for_recovery(self, _auth, _api, _git_state):
|
||||||
with open(ISSUE_LOCK_FILE, "w", encoding="utf-8") as f:
|
with open(ISSUE_LOCK_FILE, "w", encoding="utf-8") as f:
|
||||||
json.dump({
|
json.dump({
|
||||||
"issue_number": 196,
|
"issue_number": 196,
|
||||||
|
|||||||
Reference in New Issue
Block a user