trackdb: Add scaffolding for handling library paths
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
54d7ba6556
commit
a9f0ff8f8d
|
@ -0,0 +1,25 @@
|
|||
# Copyright 2020 (c) Anna Schumaker.
|
||||
import pathlib
|
||||
import trackdb
|
||||
import unittest
|
||||
|
||||
test_tracks = pathlib.Path("./trier/Test Album")
|
||||
|
||||
class TestTrackDB(unittest.TestCase):
|
||||
def setUp(self):
|
||||
trackdb.reset()
|
||||
|
||||
def test_trackdb_init(self):
|
||||
self.assertEqual(trackdb.library_paths, [ ])
|
||||
|
||||
def test_trackdb_add_path(self):
|
||||
trackdb.add_path(test_tracks)
|
||||
self.assertEqual(trackdb.library_paths, [ test_tracks ])
|
||||
|
||||
trackdb.remove_path(test_tracks)
|
||||
self.assertEqual(trackdb.library_paths, [ ])
|
||||
|
||||
def test_trackdb_reset(self):
|
||||
trackdb.library_paths = [ 1, 2, 3 ]
|
||||
trackdb.reset()
|
||||
self.assertEqual(trackdb.library_paths, [ ])
|
|
@ -0,0 +1,12 @@
|
|||
# Copyright 2020 (c) Anna Schumaker.
|
||||
|
||||
library_paths = [ ]
|
||||
|
||||
def add_path(path):
|
||||
library_paths.append(path)
|
||||
|
||||
def remove_path(path):
|
||||
library_paths.remove(path)
|
||||
|
||||
def reset():
|
||||
library_paths.clear()
|
Loading…
Reference in New Issue