Fix API parameter name: use 'demotion_week' instead of 'dem_week'
The API expects 'demotion_week' as the query parameter name, not 'dem_week'. Updated service to send correct parameter name and tests to verify. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
c7820eaea0
commit
060287b7ca
@ -423,7 +423,7 @@ class PlayerService(BaseService[Player]):
|
||||
# Build update dictionary
|
||||
updates = {"team_id": new_team_id}
|
||||
if dem_week is not None:
|
||||
updates["dem_week"] = dem_week
|
||||
updates["demotion_week"] = dem_week
|
||||
|
||||
updated_player = await self.update_player(player_id, updates)
|
||||
|
||||
|
||||
@ -453,10 +453,10 @@ class TestPlayerTeamUpdateWithDemWeek:
|
||||
assert result is not None
|
||||
assert result.team_id == new_team_id
|
||||
|
||||
# Verify API call included dem_week
|
||||
# Verify API call included demotion_week
|
||||
mock_client.patch.assert_called_once_with(
|
||||
"players",
|
||||
{"team_id": new_team_id, "dem_week": dem_week},
|
||||
{"team_id": new_team_id, "demotion_week": dem_week},
|
||||
player_id,
|
||||
use_query_params=True
|
||||
)
|
||||
@ -488,9 +488,9 @@ class TestPlayerTeamUpdateWithDemWeek:
|
||||
assert result is not None
|
||||
assert result.team_id == new_team_id
|
||||
|
||||
# Verify API call did NOT include dem_week
|
||||
# Verify API call did NOT include demotion_week
|
||||
call_args = mock_client.patch.call_args[0][1]
|
||||
assert "dem_week" not in call_args
|
||||
assert "demotion_week" not in call_args
|
||||
assert call_args == {"team_id": new_team_id}
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -516,9 +516,9 @@ class TestPlayerTeamUpdateWithDemWeek:
|
||||
player_id, new_team_id, dem_week=dem_week
|
||||
)
|
||||
|
||||
# Verify API call included dem_week=0
|
||||
# Verify API call included demotion_week=0
|
||||
call_args = mock_client.patch.call_args[0][1]
|
||||
assert call_args == {"team_id": new_team_id, "dem_week": 0}
|
||||
assert call_args == {"team_id": new_team_id, "demotion_week": 0}
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_update_player_team_dem_week_none_explicit(
|
||||
@ -542,6 +542,6 @@ class TestPlayerTeamUpdateWithDemWeek:
|
||||
player_id, new_team_id, dem_week=None
|
||||
)
|
||||
|
||||
# Verify API call did NOT include dem_week
|
||||
# Verify API call did NOT include demotion_week
|
||||
call_args = mock_client.patch.call_args[0][1]
|
||||
assert "dem_week" not in call_args
|
||||
assert "demotion_week" not in call_args
|
||||
|
||||
Loading…
Reference in New Issue
Block a user