| 149 | } |
| 150 | |
| 151 | func TestPlayUriTransferPlaybackPauseError(t *testing.T) { |
| 152 | const n = "test_device_name" |
| 153 | viper.Set("spotify.device_name", n) |
| 154 | |
| 155 | m := new(mocks.Client) |
| 156 | |
| 157 | ds := []spotify.PlayerDevice{ |
| 158 | { |
| 159 | ID: "ANOTHER_TEST_ID", |
| 160 | Active: true, |
| 161 | Restricted: false, |
| 162 | Name: "another_device_name", |
| 163 | Type: "", |
| 164 | Volume: 0, |
| 165 | }, |
| 166 | { |
| 167 | ID: "TEST_ID", |
| 168 | Active: false, |
| 169 | Restricted: false, |
| 170 | Name: n, |
| 171 | Type: "", |
| 172 | Volume: 0, |
| 173 | }, |
| 174 | } |
| 175 | |
| 176 | m.On("PlayerDevices").Return(ds, nil) |
| 177 | const e = "pause error" |
| 178 | m.On("Pause").Return(errors.New(e)) |
| 179 | |
| 180 | err := PlayUri(m, "foobar") |
| 181 | assert.EqualError(t, err, e) |
| 182 | } |
| 183 | |
| 184 | func TestPlayUriTransferPlaybackTransferError(t *testing.T) { |
| 185 | const n = "test_device_name" |