trackdb: Add scaffolding for handling library paths

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2020-10-04 12:58:15 -04:00
parent 54d7ba6556
commit a9f0ff8f8d
2 changed files with 37 additions and 0 deletions

25
test_trackdb.py Normal file
View File

@ -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, [ ])

12
trackdb/__init__.py Normal file
View File

@ -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()