|
11 | 11 | import pytest |
12 | 12 | from yarl import URL |
13 | 13 |
|
14 | | -from spotifyaio import RepeatMode, SpotifyClient, SpotifyConnectionError, SpotifyError |
| 14 | +from spotifyaio import RepeatMode, SpotifyClient, SpotifyConnectionError |
15 | 15 |
|
16 | 16 | from . import load_fixture |
17 | 17 | from .const import HEADERS, SPOTIFY_URL |
@@ -74,21 +74,6 @@ async def _get_token() -> str: |
74 | 74 | assert spotify._token == "token" # pylint: disable=protected-access |
75 | 75 |
|
76 | 76 |
|
77 | | -async def test_unexpected_server_response( |
78 | | - responses: aioresponses, |
79 | | - authenticated_client: SpotifyClient, |
80 | | -) -> None: |
81 | | - """Test handling unexpected response.""" |
82 | | - responses.get( |
83 | | - f"{SPOTIFY_URL}/v1/me/player?additional_types=track,episode", |
84 | | - status=200, |
85 | | - headers={"Content-Type": "plain/text"}, |
86 | | - body="Yes", |
87 | | - ) |
88 | | - with pytest.raises(SpotifyError): |
89 | | - assert await authenticated_client.get_playback() |
90 | | - |
91 | | - |
92 | 77 | async def test_timeout( |
93 | 78 | responses: aioresponses, |
94 | 79 | ) -> None: |
@@ -167,8 +152,7 @@ async def test_transfer_playback( |
167 | 152 | ) -> None: |
168 | 153 | """Test transferring playback.""" |
169 | 154 | responses.put( |
170 | | - f"{SPOTIFY_URL}/v1/me/player", |
171 | | - status=204, |
| 155 | + f"{SPOTIFY_URL}/v1/me/player", status=200, body="3o0RYoo5iOMKSmEbunsbvW" |
172 | 156 | ) |
173 | 157 | await authenticated_client.transfer_playback("test") |
174 | 158 | responses.assert_called_once_with( |
@@ -296,10 +280,7 @@ async def test_resume_playback( |
296 | 280 | path="/v1/me/player/play", |
297 | 281 | query=expected_params, |
298 | 282 | ) |
299 | | - responses.put( |
300 | | - url, |
301 | | - status=204, |
302 | | - ) |
| 283 | + responses.put(url, status=200, body="3o0RYoo5iOMKSmEbunsbvW") |
303 | 284 | await authenticated_client.start_playback(**arguments) |
304 | 285 | responses.assert_called_once_with( |
305 | 286 | f"{SPOTIFY_URL}/v1/me/player/play", |
@@ -331,10 +312,7 @@ async def test_pause_playback( |
331 | 312 | path="/v1/me/player/pause", |
332 | 313 | query=expected_params, |
333 | 314 | ) |
334 | | - responses.put( |
335 | | - url, |
336 | | - status=204, |
337 | | - ) |
| 315 | + responses.put(url, status=200, body="3o0RYoo5iOMKSmEbunsbvW") |
338 | 316 | await authenticated_client.pause_playback(**arguments) |
339 | 317 | responses.assert_called_once_with( |
340 | 318 | f"{SPOTIFY_URL}/v1/me/player/pause", |
@@ -366,10 +344,7 @@ async def test_next_track( |
366 | 344 | path="/v1/me/player/next", |
367 | 345 | query=expected_params, |
368 | 346 | ) |
369 | | - responses.post( |
370 | | - url, |
371 | | - status=204, |
372 | | - ) |
| 347 | + responses.post(url, status=200, body="3o0RYoo5iOMKSmEbunsbvW") |
373 | 348 | await authenticated_client.next_track(**arguments) |
374 | 349 | responses.assert_called_once_with( |
375 | 350 | f"{SPOTIFY_URL}/v1/me/player/next", |
@@ -401,10 +376,7 @@ async def test_previous_track( |
401 | 376 | path="/v1/me/player/previous", |
402 | 377 | query=expected_params, |
403 | 378 | ) |
404 | | - responses.post( |
405 | | - url, |
406 | | - status=204, |
407 | | - ) |
| 379 | + responses.post(url, status=200, body="3o0RYoo5iOMKSmEbunsbvW") |
408 | 380 | await authenticated_client.previous_track(**arguments) |
409 | 381 | responses.assert_called_once_with( |
410 | 382 | f"{SPOTIFY_URL}/v1/me/player/previous", |
@@ -439,10 +411,7 @@ async def test_seek_track( |
439 | 411 | path="/v1/me/player/seek", |
440 | 412 | query=expected_params, |
441 | 413 | ) |
442 | | - responses.put( |
443 | | - url, |
444 | | - status=204, |
445 | | - ) |
| 414 | + responses.put(url, status=200, body="3o0RYoo5iOMKSmEbunsbvW") |
446 | 415 | await authenticated_client.seek_track(**arguments) |
447 | 416 | responses.assert_called_once_with( |
448 | 417 | f"{SPOTIFY_URL}/v1/me/player/seek", |
@@ -479,10 +448,7 @@ async def test_set_repeat( |
479 | 448 | path="/v1/me/player/repeat", |
480 | 449 | query=expected_params, |
481 | 450 | ) |
482 | | - responses.put( |
483 | | - url, |
484 | | - status=204, |
485 | | - ) |
| 451 | + responses.put(url, status=200, body="3o0RYoo5iOMKSmEbunsbvW") |
486 | 452 | await authenticated_client.set_repeat(**arguments) |
487 | 453 | responses.assert_called_once_with( |
488 | 454 | f"{SPOTIFY_URL}/v1/me/player/repeat", |
@@ -517,10 +483,7 @@ async def test_set_volume( |
517 | 483 | path="/v1/me/player/volume", |
518 | 484 | query=expected_params, |
519 | 485 | ) |
520 | | - responses.put( |
521 | | - url, |
522 | | - status=204, |
523 | | - ) |
| 486 | + responses.put(url, status=200, body="3o0RYoo5iOMKSmEbunsbvW") |
524 | 487 | await authenticated_client.set_volume(**arguments) |
525 | 488 | responses.assert_called_once_with( |
526 | 489 | f"{SPOTIFY_URL}/v1/me/player/volume", |
@@ -555,10 +518,7 @@ async def test_set_shuffle( |
555 | 518 | path="/v1/me/player/shuffle", |
556 | 519 | query=expected_params, |
557 | 520 | ) |
558 | | - responses.put( |
559 | | - url, |
560 | | - status=204, |
561 | | - ) |
| 521 | + responses.put(url, status=200, body="3o0RYoo5iOMKSmEbunsbvW") |
562 | 522 | await authenticated_client.set_shuffle(**arguments) |
563 | 523 | responses.assert_called_once_with( |
564 | 524 | f"{SPOTIFY_URL}/v1/me/player/shuffle", |
@@ -590,8 +550,7 @@ async def test_add_to_queue( |
590 | 550 | ) -> None: |
591 | 551 | """Test adding to queue.""" |
592 | 552 | responses.post( |
593 | | - f"{SPOTIFY_URL}/v1/me/player/queue", |
594 | | - status=204, |
| 553 | + f"{SPOTIFY_URL}/v1/me/player/queue", status=200, body="3o0RYoo5iOMKSmEbunsbvW" |
595 | 554 | ) |
596 | 555 | await authenticated_client.add_to_queue(**arguments) |
597 | 556 | responses.assert_called_once_with( |
|
0 commit comments