mirror of
https://github.com/beetbox/beets.git
synced 2025-12-07 09:04:33 +01:00
test helper: add support for multi-disc album fixtures
This commit is contained in:
parent
c0af86c04a
commit
ad4c68112f
1 changed files with 13 additions and 11 deletions
|
|
@ -373,21 +373,23 @@ class TestHelper:
|
|||
items.append(item)
|
||||
return items
|
||||
|
||||
def add_album_fixture(self, track_count=1, ext='mp3'):
|
||||
def add_album_fixture(self, track_count=1, ext='mp3', disc_count=1):
|
||||
"""Add an album with files to the database.
|
||||
"""
|
||||
items = []
|
||||
path = os.path.join(_common.RSRC, util.bytestring_path('full.' + ext))
|
||||
for i in range(track_count):
|
||||
item = Item.from_path(path)
|
||||
item.album = '\u00e4lbum' # Check unicode paths
|
||||
item.title = f't\u00eftle {i}'
|
||||
# mtime needs to be set last since other assignments reset it.
|
||||
item.mtime = 12345
|
||||
item.add(self.lib)
|
||||
item.move(operation=MoveOperation.COPY)
|
||||
item.store()
|
||||
items.append(item)
|
||||
for discnumber in range(1, disc_count + 1):
|
||||
for i in range(track_count):
|
||||
item = Item.from_path(path)
|
||||
item.album = '\u00e4lbum' # Check unicode paths
|
||||
item.title = f't\u00eftle {i}'
|
||||
item.disc = discnumber
|
||||
# mtime needs to be set last since other assignments reset it.
|
||||
item.mtime = 12345
|
||||
item.add(self.lib)
|
||||
item.move(operation=MoveOperation.COPY)
|
||||
item.store()
|
||||
items.append(item)
|
||||
return self.lib.add_album(items)
|
||||
|
||||
def create_mediafile_fixture(self, ext='mp3', images=[]):
|
||||
|
|
|
|||
Loading…
Reference in a new issue