MCPcopy Create free account
hub / github.com/dinofizz/diskplayer / TestPlayUriTransferPlaybackTransferError

Function TestPlayUriTransferPlaybackTransferError

diskplayer_test.go:184–217  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

182}
183
184func TestPlayUriTransferPlaybackTransferError(t *testing.T) {
185 const n = "test_device_name"
186 viper.Set("spotify.device_name", n)
187
188 m := new(mocks.Client)
189
190 ds := []spotify.PlayerDevice{
191 {
192 ID: "ANOTHER_TEST_ID",
193 Active: true,
194 Restricted: false,
195 Name: "another_device_name",
196 Type: "",
197 Volume: 0,
198 },
199 {
200 ID: "TEST_ID",
201 Active: false,
202 Restricted: false,
203 Name: n,
204 Type: "",
205 Volume: 0,
206 },
207 }
208
209 m.On("PlayerDevices").Return(ds, nil)
210 const e = "transfer error"
211 m.On("Pause").Return(nil)
212 m.On("TransferPlayback", mock.AnythingOfType("spotify.ID"), false).Return(errors.New(e))
213 m.On("PlayOpt", mock.AnythingOfType("*spotify.PlayOptions")).Return(nil)
214
215 err := PlayUri(m, "foobar")
216 assert.EqualError(t, err, e)
217}
218
219func TestPauseSuccess(t *testing.T) {
220 const n = "test_device_name"

Callers

nothing calls this directly

Calls 1

PlayUriFunction · 0.85

Tested by

no test coverage detected