refactor: Update player seek functionality to use consistent position field across schemas and services
All checks were successful
Backend CI / test (push) Successful in 4m5s
All checks were successful
Backend CI / test (push) Successful in 4m5s
This commit is contained in:
@@ -278,17 +278,17 @@ class TestPlayerEndpoints:
|
||||
mock_player_service,
|
||||
):
|
||||
"""Test seeking to position successfully."""
|
||||
position_ms = 5000
|
||||
position = 5000
|
||||
response = await authenticated_client.post(
|
||||
"/api/v1/player/seek",
|
||||
json={"position_ms": position_ms},
|
||||
json={"position": position},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["message"] == f"Seeked to position {position_ms}ms"
|
||||
assert data["message"] == f"Seeked to position {position}ms"
|
||||
|
||||
mock_player_service.seek.assert_called_once_with(position_ms)
|
||||
mock_player_service.seek.assert_called_once_with(position)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_seek_invalid_position(
|
||||
@@ -300,7 +300,7 @@ class TestPlayerEndpoints:
|
||||
"""Test seeking with invalid position."""
|
||||
response = await authenticated_client.post(
|
||||
"/api/v1/player/seek",
|
||||
json={"position_ms": -1000}, # Negative position
|
||||
json={"position": -1000}, # Negative position
|
||||
)
|
||||
|
||||
assert response.status_code == 422 # Validation error
|
||||
@@ -310,7 +310,7 @@ class TestPlayerEndpoints:
|
||||
"""Test seeking without authentication."""
|
||||
response = await client.post(
|
||||
"/api/v1/player/seek",
|
||||
json={"position_ms": 5000},
|
||||
json={"position": 5000},
|
||||
)
|
||||
assert response.status_code == 401
|
||||
|
||||
@@ -326,7 +326,7 @@ class TestPlayerEndpoints:
|
||||
|
||||
response = await authenticated_client.post(
|
||||
"/api/v1/player/seek",
|
||||
json={"position_ms": 5000},
|
||||
json={"position": 5000},
|
||||
)
|
||||
|
||||
assert response.status_code == 500
|
||||
@@ -516,8 +516,8 @@ class TestPlayerEndpoints:
|
||||
"status": PlayerStatus.PLAYING.value,
|
||||
"mode": PlayerMode.CONTINUOUS.value,
|
||||
"volume": 50,
|
||||
"position_ms": 5000,
|
||||
"duration_ms": 30000,
|
||||
"position": 5000,
|
||||
"duration": 30000,
|
||||
"index": 0,
|
||||
"current_sound": {
|
||||
"id": 1,
|
||||
@@ -625,7 +625,7 @@ class TestPlayerEndpoints:
|
||||
"""Test seeking to position zero."""
|
||||
response = await authenticated_client.post(
|
||||
"/api/v1/player/seek",
|
||||
json={"position_ms": 0},
|
||||
json={"position": 0},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user