Beispiel #1
0
    def test_update_rating(self):
        item = Item(title=u'title', path='', id=1)
        item.add(self.lib)

        log = Mock()
        mpdstats = MPDStats(self.lib, log)

        self.assertFalse(mpdstats.update_rating(item, True))
        self.assertFalse(mpdstats.update_rating(None, True))
Beispiel #2
0
    def test_get_item(self):
        item_path = '/foo/bar.flac'
        item = Item(title=u'title', path=item_path, id=1)
        item.add(self.lib)

        log = Mock()
        mpdstats = MPDStats(self.lib, log)

        self.assertEqual(str(mpdstats.get_item(item_path)), str(item))
        self.assertIsNone(mpdstats.get_item('/some/non-existing/path'))
        self.assertIn(u'item not found:', log.info.call_args[0][0])
Beispiel #3
0
    def test_run_mpdstats(self, mpd_mock):
        item = Item(title=u'title', path=self.item_path, id=1)
        item.add(self.lib)

        log = Mock()
        try:
            MPDStats(self.lib, log).run()
        except KeyboardInterrupt:
            pass

        log.debug.assert_has_calls(
            [call(u'unhandled status "{0}"', ANY)])
        log.info.assert_has_calls(
            [call(u'pause'), call(u'playing {0}', ANY), call(u'stop')])