resolve conflicts for PR #461
This commit is contained in:
+24
-19
@@ -3087,8 +3087,9 @@ class TestIssueLocking(unittest.TestCase):
|
||||
"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_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")
|
||||
self.assertTrue(res["success"])
|
||||
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",
|
||||
return_value=_clean_master_git_state_for_lock(),
|
||||
)
|
||||
@patch("mcp_server.api_get_all")
|
||||
@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.
|
||||
def _api(url, *a, **k):
|
||||
if "/pulls" in url:
|
||||
return [{
|
||||
"number": 200,
|
||||
"head": {"ref": "feat/issue-196-mutations"},
|
||||
"title": "WIP",
|
||||
"body": "",
|
||||
}]
|
||||
if "/branches" in url:
|
||||
return [{"name": "feat/issue-196-mutations", "commit": {"id": "abc"}}]
|
||||
return []
|
||||
|
||||
mock_api.side_effect = _api
|
||||
self.mock_dup_fetcher.return_value = ([{
|
||||
"number": 200,
|
||||
"head": {"ref": "feat/issue-196-mutations"},
|
||||
"title": "WIP",
|
||||
"body": "",
|
||||
}], ["feat/issue-196-mutations"], {"status": "not_claimed"})
|
||||
with self.assertRaises(ValueError) as ctx:
|
||||
gitea_lock_issue(
|
||||
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))
|
||||
|
||||
@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)
|
||||
|
||||
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:
|
||||
json.dump({
|
||||
"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")
|
||||
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:
|
||||
json.dump({
|
||||
"issue_number": 196,
|
||||
|
||||
Reference in New Issue
Block a user