Fixed invalid test assumptions

This commit is contained in:
Fahad
2025-06-11 18:49:30 +04:00
parent 8a869661bb
commit b0f17f741f
2 changed files with 13 additions and 10 deletions

View File

@@ -196,8 +196,8 @@ class TestClaudeContinuationOffers:
assert response_data.get("continuation_offer") is None
@patch("utils.conversation_memory.get_redis_client")
async def test_threaded_conversation_no_continuation_offer(self, mock_redis):
"""Test that threaded conversations don't get continuation offers"""
async def test_threaded_conversation_with_continuation_offer(self, mock_redis):
"""Test that threaded conversations still get continuation offers when turns remain"""
mock_client = Mock()
mock_redis.return_value = mock_client
@@ -234,9 +234,10 @@ class TestClaudeContinuationOffers:
# Parse response
response_data = json.loads(response[0].text)
# Should be regular success, not continuation offer
assert response_data["status"] == "success"
assert response_data.get("continuation_offer") is None
# Should offer continuation since there are remaining turns (9 remaining: 10 max - 0 current - 1)
assert response_data["status"] == "continuation_available"
assert response_data.get("continuation_offer") is not None
assert response_data["continuation_offer"]["remaining_turns"] == 9
def test_max_turns_reached_no_continuation_offer(self):
"""Test that no continuation is offered when max turns would be exceeded"""
@@ -404,9 +405,11 @@ class TestContinuationIntegration:
# Step 3: Claude uses continuation_id
request2 = ToolRequest(prompt="Now analyze the performance aspects", continuation_id=thread_id)
# This should NOT offer another continuation (already threaded)
# Should still offer continuation if there are remaining turns
continuation_data2 = self.tool._check_continuation_opportunity(request2)
assert continuation_data2 is None
assert continuation_data2 is not None
assert continuation_data2["remaining_turns"] == 8 # MAX_CONVERSATION_TURNS(10) - current_turns(1) - 1
assert continuation_data2["tool_name"] == "test_continuation"
if __name__ == "__main__":

View File

@@ -186,8 +186,8 @@ class TestCrossToolContinuation:
response = await self.review_tool.execute(arguments)
response_data = json.loads(response[0].text)
# Should successfully continue the conversation
assert response_data["status"] == "success"
# Should offer continuation since there are remaining turns available
assert response_data["status"] == "continuation_available"
assert "Critical security vulnerability confirmed" in response_data["content"]
# Step 4: Verify the cross-tool continuation worked
@@ -307,7 +307,7 @@ class TestCrossToolContinuation:
response = await self.review_tool.execute(arguments)
response_data = json.loads(response[0].text)
assert response_data["status"] == "success"
assert response_data["status"] == "continuation_available"
# Verify files from both tools are tracked in Redis calls
setex_calls = mock_client.setex.call_args_list