fix(test): assert _add_team_member_budget_table returns a copy, not mutation

PR #36234 refactored _add_team_member_budget_table to return
model_copy(update=...) instead of mutating its input, but the success
test still asserted result == team_info_response, which now fails
because the input stays unmutated with team_member_budget_table=None
while the returned copy carries the budget record. Rewrite the
assertions to pin the new no-mutation contract: the return value is a
distinct object, the input's budget field is untouched, the copy has
the budget attached, and the other fields still match.

Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-08-08 03:08:16 +00:00
parent f05d468769
commit 83aeadbb1a
No known key found for this signature in database

View file

@ -924,18 +924,18 @@ async def test_add_team_member_budget_table_success():
team_id="test-team-123", team_alias="Test Team"
)
# Call the function
result = await _add_team_member_budget_table(
team_member_budget_id="budget-123",
prisma_client=mock_prisma_client,
team_info_response_object=team_info_response,
)
# Verify the result
assert result == team_info_response
assert result is not team_info_response
assert team_info_response.team_member_budget_table is None
assert result.team_member_budget_table == mock_budget_record
assert result.team_id == team_info_response.team_id
assert result.team_alias == team_info_response.team_alias
# Verify database call was made correctly
mock_prisma_client.db.litellm_budgettable.find_unique.assert_called_once_with(
where={"budget_id": "budget-123"}
)