34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
# Copyright 2019 (c) Anna Schumaker.
|
|
from . import library
|
|
from . import playlist
|
|
from .. import tags
|
|
from .. import threadqueue
|
|
import os
|
|
import time
|
|
import unittest
|
|
|
|
test_library = os.path.abspath("./trier/Test Library")
|
|
|
|
class TestLibraryPlaylist(unittest.TestCase):
|
|
def setUp(self):
|
|
library.library_thread.stop()
|
|
library.library_thread = threadqueue.ThreadQueue()
|
|
tags.tag_map.clear()
|
|
|
|
def tearDownClass():
|
|
library.library_thread.stop()
|
|
|
|
def test_playlist_library_init(self):
|
|
self.assertIsInstance(library.library_thread, threadqueue.ThreadQueue)
|
|
|
|
plist = library.LibraryPlaylist(test_library + "/")
|
|
self.assertIsInstance(plist, playlist.Playlist)
|
|
self.assertEqual(plist.name, test_library)
|
|
|
|
def test_playlist_library_scan(self):
|
|
plist = library.LibraryPlaylist(test_library)
|
|
self.assertGreater(library.library_thread.qsize(), 0)
|
|
library.library_thread.join()
|
|
self.assertEqual(len(plist), 1250)
|
|
self.assertEqual(plist.runtime(), "1 hour, 54 minutes, 35 seconds")
|