Exemple #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())
Exemple #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)
Exemple #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)
Exemple #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())
Exemple #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))
Exemple #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))
Exemple #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))
Exemple #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)
Exemple #9
0
 def test_list_album_outputs_something(self):
     commands.list_items(self.lib, '', True)
     out = self.io.getoutput()
     self.assertGreater(len(out), 0)
Exemple #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)
Exemple #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')
Exemple #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
Exemple #13
0
 def _run_list(self, query='', album=False, path=False, fmt=None):
     commands.list_items(self.lib, query, album, fmt)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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
Exemple #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')
Exemple #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)
Exemple #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')
Exemple #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)
Exemple #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)
Exemple #26
0
 def _run_list(self, query=u'', album=False, path=False, fmt=''):
     commands.list_items(self.lib, query, album, fmt)
Exemple #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)
Exemple #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')