Made unit tests

This commit is contained in:
James Clarke 2023-03-23 17:30:06 +00:00
parent 2c6d751816
commit 012aac5b2c
No known key found for this signature in database
GPG Key ID: 5C7702CCFCA2ADC9

View File

@ -5,10 +5,13 @@ import sys
import os import os
# Add the parent directory of the src package to the Python module search path # Add the parent directory of the src package to the Python module search path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from music_kraken import objects from music_kraken import objects
from music_kraken import metadata
class TestSong(unittest.TestCase): class TestSong(unittest.TestCase):
def setUp(self): def setUp(self):
@ -149,7 +152,7 @@ class TestAlbum(unittest.TestCase):
class TestCollection(unittest.TestCase): class TestCollection(unittest.TestCase):
def setUp(self): def setUp(self):
self.collection = objects.Collection( self.collection = objects.collection.Collection(
title="A collection", title="A collection",
date=objects.ID3Timestamp(year=1986, month=3, day=1), date=objects.ID3Timestamp(year=1986, month=3, day=1),
language=pycountry.languages.get(alpha_2="en"), language=pycountry.languages.get(alpha_2="en"),
@ -163,7 +166,7 @@ class TestCollection(unittest.TestCase):
) )
def test_collection_title(self): def test_collection_title(self):
self.assertEqual(self.collection.title, "A collection") self.assertEqual(self.collection, "A collection")
def test_collection_date(self): def test_collection_date(self):
self.assertEqual(self.collection.date.year, 1986) self.assertEqual(self.collection.date.year, 1986)