mirror of
https://github.com/beetbox/beets.git
synced 2025-12-07 17:16:07 +01:00
move BaseAlbum tests to test_db (with other album tests)
This commit is contained in:
parent
adefff10dd
commit
ce5f9f9936
2 changed files with 9 additions and 45 deletions
|
|
@ -508,6 +508,15 @@ class AlbumInfoTest(unittest.TestCase):
|
|||
c = self.lib.conn.execute('SELECT id FROM items WHERE id=?', (item_id,))
|
||||
self.assertEqual(c.fetchone(), None)
|
||||
|
||||
class BaseAlbumTest(unittest.TestCase):
|
||||
def test_field_access(self):
|
||||
album = beets.library.BaseAlbum(None, {'fld1':'foo'})
|
||||
self.assertEqual(album.fld1, 'foo')
|
||||
|
||||
def test_field_access_unset_values(self):
|
||||
album = beets.library.BaseAlbum(None, {})
|
||||
self.assertRaises(AttributeError, getattr, album, 'field')
|
||||
|
||||
class ArtDestinationTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.lib = beets.library.Library(':memory:')
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
# This file is part of beets.
|
||||
# Copyright 2010, Adrian Sampson.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
"""Basic tests for the objects that are used to represent the beets
|
||||
library and the items in it.
|
||||
"""
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
sys.path.append('..')
|
||||
from beets.library import BaseLibrary, BaseAlbum
|
||||
|
||||
class AlbumTest(unittest.TestCase):
|
||||
|
||||
def test_field_access(self):
|
||||
album = BaseAlbum(None, {'artist':'foo', 'albumartist':'bar'})
|
||||
self.assertEqual(album.artist, 'foo')
|
||||
self.assertEqual(album.albumartist, 'bar')
|
||||
|
||||
def test_field_access_unset_values(self):
|
||||
"""
|
||||
This is how things work currently. Trying to access unset album
|
||||
metadata raises an AttributeError.
|
||||
"""
|
||||
album = BaseAlbum(None, {})
|
||||
self.assertRaises(AttributeError, getattr, album, 'albumartist')
|
||||
self.assertRaises(AttributeError, getattr, album, 'artist')
|
||||
|
||||
def suite():
|
||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(defaultTest='suite')
|
||||
|
||||
Loading…
Reference in a new issue