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:
Cal Corum 2026-02-01 21:27:52 -06:00
parent c7820eaea0
commit 060287b7ca
2 changed files with 9 additions and 9 deletions

View File

@ -423,7 +423,7 @@ class PlayerService(BaseService[Player]):
# Build update dictionary # Build update dictionary
updates = {"team_id": new_team_id} updates = {"team_id": new_team_id}
if dem_week is not None: 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) updated_player = await self.update_player(player_id, updates)

View File

@ -453,10 +453,10 @@ class TestPlayerTeamUpdateWithDemWeek:
assert result is not None assert result is not None
assert result.team_id == new_team_id 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( mock_client.patch.assert_called_once_with(
"players", "players",
{"team_id": new_team_id, "dem_week": dem_week}, {"team_id": new_team_id, "demotion_week": dem_week},
player_id, player_id,
use_query_params=True use_query_params=True
) )
@ -488,9 +488,9 @@ class TestPlayerTeamUpdateWithDemWeek:
assert result is not None assert result is not None
assert result.team_id == new_team_id 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] 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} assert call_args == {"team_id": new_team_id}
@pytest.mark.asyncio @pytest.mark.asyncio
@ -516,9 +516,9 @@ class TestPlayerTeamUpdateWithDemWeek:
player_id, new_team_id, dem_week=dem_week 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] 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 @pytest.mark.asyncio
async def test_update_player_team_dem_week_none_explicit( async def test_update_player_team_dem_week_none_explicit(
@ -542,6 +542,6 @@ class TestPlayerTeamUpdateWithDemWeek:
player_id, new_team_id, dem_week=None 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] call_args = mock_client.patch.call_args[0][1]
assert "dem_week" not in call_args assert "demotion_week" not in call_args