Skip to content

Commit

Permalink
tested episode playback state resume
Browse files Browse the repository at this point in the history
  • Loading branch information
fcusson committed Dec 18, 2024
1 parent 6e4d0d3 commit e28765a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/spotcast/services/transfer_playback.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async def async_rebuild_playback(
last_playback_state: dict = account.last_playback_state
context_uri: str = last_playback_state["context"]["uri"]
context_type: str = last_playback_state["context"]["type"]
extras = call_data["data"]
extras = call_data.get("data", {})

# set the context_uri in the call_data
call_data["spotify_uri"] = context_uri
Expand Down
27 changes: 27 additions & 0 deletions test/services/transfer_playback/test_async_rebuild_playback.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,3 +603,30 @@ def test_track_index_not_called(self):
self.mocks["index"].assert_not_called()
except AssertionError:
self.fail()


class TestShowContext(IsolatedAsyncioTestCase):

async def asyncSetUp(self):

self.mocks = {
"account": MagicMock(spec=SpotifyAccount)
}

self.mocks["account"].last_playback_state = {
"context": {
"uri": "spotify:show:foo",
"type": "show"
},
"item": {
"uri": "spotify:episode:bar"
},
"repeat_state": "context",
"shuffle_state": False,
"progress_ms": 2000,
}

self.result = await async_rebuild_playback({}, self.mocks["account"])

def test_context_changed_to_episode(self):
self.assertEqual(self.result["spotify_uri"], "spotify:episode:bar")

0 comments on commit e28765a

Please sign in to comment.