mirror of
https://github.com/beetbox/beets.git
synced 2025-12-27 11:02:43 +01:00
Add test for #4863 importfeeds m3u_session feature
This commit is contained in:
parent
411350cf2a
commit
546e1b8751
1 changed files with 18 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ import os.path
|
|||
import tempfile
|
||||
import shutil
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
from beets import config
|
||||
from beets.library import Item, Album, Library
|
||||
|
|
@ -54,6 +55,23 @@ class ImportfeedsTestTest(unittest.TestCase):
|
|||
self.assertTrue(os.path.isdir(playlist_subdir))
|
||||
self.assertTrue(os.path.isfile(playlist))
|
||||
|
||||
def test_playlist_per_session(self):
|
||||
config['importfeeds']['formats'] = 'm3u_session'
|
||||
config['importfeeds']['m3u_name'] = 'imports.m3u'
|
||||
album = Album(album='album/name', id=1)
|
||||
item_path = os.path.join('path', 'to', 'item')
|
||||
item = Item(title='song', album_id=1, path=item_path)
|
||||
self.lib.add(album)
|
||||
self.lib.add(item)
|
||||
|
||||
self.importfeeds.import_begin(self)
|
||||
self.importfeeds.album_imported(self.lib, album)
|
||||
date = datetime.datetime.now().strftime("%Y%m%d_%Hh%M")
|
||||
playlist = os.path.join(self.feeds_dir, 'imports_' + date + '.m3u')
|
||||
self.assertTrue(os.path.isfile(playlist))
|
||||
with open(playlist) as playlist_contents:
|
||||
self.assertIn(item_path, playlist_contents.read())
|
||||
|
||||
|
||||
def suite():
|
||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||
|
|
|
|||
Loading…
Reference in a new issue