Example #1
0
 def test_list_item_format_multiple(self):
     commands.list_items(self.lib, '', False, False, '$artist - $album - $year')
     out = self.io.getoutput()
     self.assertTrue(u'1' in out)
     self.assertTrue(u'the album' in out)
     self.assertTrue(u'the artist' in out)
     self.assertEqual(u'the artist - the album - 1', out.strip())
Example #2
0
 def _run_list(self, query='', album=False, path=False, fmt=None):
     if not fmt:
         if album:
             fmt = commands.DEFAULT_LIST_FORMAT_ALBUM
         else:
             fmt = commands.DEFAULT_LIST_FORMAT_ITEM
     commands.list_items(self.lib, query, album, path, fmt)
Example #3
0
 def _run_list(self, query='', album=False, path=False, fmt=None):
     if not fmt:
         if album:
             fmt = commands.DEFAULT_LIST_FORMAT_ALBUM
         else:
             fmt = commands.DEFAULT_LIST_FORMAT_ITEM
     commands.list_items(self.lib, query, album, path, fmt)
Example #4
0
 def test_list_item_format_multiple(self):
     commands.list_items(self.lib, "", False, False, "$artist - $album - $year")
     out = self.io.getoutput()
     self.assertTrue(u"1" in out)
     self.assertTrue(u"the album" in out)
     self.assertTrue(u"the artist" in out)
     self.assertEqual(u"the artist - the album - 1", out.strip())
Example #5
0
    def test_list_unicode_query(self):
        self.item.title = u"na\xefve"
        self.lib.store(self.item)
        self.lib.save()

        commands.list_items(self.lib, [u"na\xefve"], False, False, None)
        out = self.io.getoutput()
        self.assertTrue(u"na\xefve" in out.decode(self.io.stdout.encoding))
Example #6
0
    def test_list_unicode_query(self):
        self.item.title = u'na\xefve'
        self.lib.store(self.item)
        self.lib.conn.commit()

        commands.list_items(self.lib, [u'na\xefve'], False, False, None)
        out = self.io.getoutput()
        self.assertTrue(u'na\xefve' in out.decode(self.io.stdout.encoding))
Example #7
0
    def test_list_unicode_query(self):
        self.item.title = u'na\xefve'
        self.lib.store(self.item)
        self.lib.save()

        commands.list_items(self.lib, [u'na\xefve'], False, False)
        out = self.io.getoutput()
        self.assertTrue(u'na\xefve' in out.decode(self.io.stdout.encoding))
Example #8
0
 def test_list_outputs_item(self):
     commands.list_items(self.lib, '', False, False, None)
     out = self.io.getoutput()
     self.assertTrue(u'the title' in out)
Example #9
0
 def test_list_album_outputs_something(self):
     commands.list_items(self.lib, '', True)
     out = self.io.getoutput()
     self.assertGreater(len(out), 0)
Example #10
0
 def test_list_album_format(self):
     commands.list_items(self.lib, '', True, False, '$genre')
     out = self.io.getoutput()
     self.assertTrue(u'the genre' in out)
     self.assertTrue(u'the album' not in out)
Example #11
0
 def test_list_item_path_ignores_format(self):
     commands.list_items(self.lib, '', False, True, '$year - $artist')
     out = self.io.getoutput()
     self.assertEqual(out.strip(), u'xxx/yyy')
Example #12
0
 def _run_list(self, query=u'', album=False, path=False, fmt=u''):
     with capture_stdout() as stdout:
         commands.list_items(self.lib, query, album, fmt)
     return stdout
Example #13
0
 def _run_list(self, query='', album=False, path=False, fmt=None):
     commands.list_items(self.lib, query, album, fmt)
Example #14
0
 def test_list_item_format_artist(self):
     commands.list_items(self.lib, '', False, False, '$artist')
     out = self.io.getoutput()
     self.assertTrue(u'the artist' in out)
Example #15
0
 def test_list_album_format(self):
     commands.list_items(self.lib, "", True, False, "$genre")
     out = self.io.getoutput()
     self.assertTrue(u"the genre" in out)
     self.assertTrue(u"the album" not in out)
Example #16
0
 def test_list_album_outputs_something(self):
     commands.list_items(self.lib, '', True, False, None)
     out = self.io.getoutput()
     self.assertGreater(len(out), 0)
Example #17
0
 def test_list_album_omits_title(self):
     commands.list_items(self.lib, '', True, False, None)
     out = self.io.getoutput()
     self.assertTrue(u'the title' not in out)
Example #18
0
 def test_list_outputs_item(self):
     commands.list_items(self.lib, '', False)
     out = self.io.getoutput()
     self.assertTrue(u'the title' in out)
Example #19
0
 def test_list_uses_track_artist(self):
     commands.list_items(self.lib, "", False, False, None)
     out = self.io.getoutput()
     self.assertTrue(u"the artist" in out)
     self.assertTrue(u"the album artist" not in out)
Example #20
0
 def _run_list(self, query=u'', album=False, path=False, fmt=u''):
     with capture_stdout() as stdout:
         commands.list_items(self.lib, query, album, fmt)
     return stdout
Example #21
0
 def test_list_item_path(self):
     commands.list_items(self.lib, '', False, True)
     out = self.io.getoutput()
     self.assertEqual(out.strip(), u'xxx/yyy')
Example #22
0
 def test_list_item_format_artist(self):
     commands.list_items(self.lib, "", False, False, "$artist")
     out = self.io.getoutput()
     self.assertTrue(u"the artist" in out)
Example #23
0
 def test_list_album_path(self):
     commands.list_items(self.lib, '', True, True, None)
     out = self.io.getoutput()
     self.assertEqual(out.strip(), u'xxx')
Example #24
0
 def test_list_album_omits_title(self):
     commands.list_items(self.lib, '', True)
     out = self.io.getoutput()
     self.assertTrue(u'the title' not in out)
Example #25
0
 def test_list_album_uses_album_artist(self):
     commands.list_items(self.lib, '', True, False, None)
     out = self.io.getoutput()
     self.assertTrue(u'the artist' not in out)
     self.assertTrue(u'the album artist' in out)
Example #26
0
 def _run_list(self, query=u'', album=False, path=False, fmt=''):
     commands.list_items(self.lib, query, album, fmt)
Example #27
0
 def test_list_album_uses_album_artist(self):
     commands.list_items(self.lib, '', True)
     out = self.io.getoutput()
     self.assertTrue(u'the artist' not in out)
     self.assertTrue(u'the album artist' in out)
Example #28
0
 def test_list_album_path(self):
     commands.list_items(self.lib, '', True, True)
     out = self.io.getoutput()
     self.assertEqual(out.strip(), u'xxx')