Example #1
0
    def test_num_handler_no_playlist(self):
        refs = ThreadingFuture()
        refs.set(None)
        self.coreMock.playlists.get_items = MagicMock(return_value=refs)

        self.dispatcher.handleCommand('num0')
        self.coreMock.playlists.get_items.assert_called_with('local:playlist:playlist0.m3u')
        self.assertEqual(0, len(self.coreMock.playback.mock_calls))
        self.assertFalse(0, len(self.coreMock.tracklist.mock_calls))
Example #2
0
    def test_num_handler_add_items(self):
        refs = ThreadingFuture()
        refs.set([Ref(uri='track1'), Ref(uri='track2')])
        self.coreMock.playlists.get_items = MagicMock(return_value=refs)

        self.dispatcher.handleCommand('num9')

        self.coreMock.playlists.get_items.assert_called_with('local:playlist:playlist9.m3u')
        self.coreMock.tracklist.add.assert_called_with(uris=['track1', 'track2'])
        self.coreMock.playback.play.assert_called_with()
    def test_num_handler_no_playlist(self):
        refs = ThreadingFuture()
        refs.set(None)
        self.coreMock.playlists.get_items = MagicMock(return_value=refs)

        self.dispatcher.handleCommand('num0')
        self.coreMock.playlists.get_items.assert_called_with(
            'local:playlist:playlist0.m3u')
        self.assertEqual(0, len(self.coreMock.playback.mock_calls))
        self.assertFalse(0, len(self.coreMock.tracklist.mock_calls))
    def test_num_handler_add_items(self):
        refs = ThreadingFuture()
        refs.set([Ref(uri='track1'), Ref(uri='track2')])
        self.coreMock.playlists.get_items = MagicMock(return_value=refs)

        self.dispatcher.handleCommand('num9')

        self.coreMock.playlists.get_items.assert_called_with(
            'local:playlist:playlist9.m3u')
        self.coreMock.tracklist.add.assert_called_with(
            uris=['track1', 'track2'])
        self.coreMock.playback.play.assert_called_with()