mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 21:14:19 +01:00
Add tests for keep_in_artist option in ftintitle
Add functionality tests for the new keep_in_artist option of the ftintitle plugin.
This commit is contained in:
parent
acb4680c72
commit
b8bd504324
1 changed files with 18 additions and 1 deletions
|
|
@ -40,10 +40,13 @@ class FtInTitlePluginFunctional(unittest.TestCase, TestHelper):
|
|||
albumartist=aartist,
|
||||
)
|
||||
|
||||
def _ft_set_config(self, ftformat, drop=False, auto=True):
|
||||
def _ft_set_config(
|
||||
self, ftformat, drop=False, auto=True, keep_in_artist=False
|
||||
):
|
||||
self.config["ftintitle"]["format"] = ftformat
|
||||
self.config["ftintitle"]["drop"] = drop
|
||||
self.config["ftintitle"]["auto"] = auto
|
||||
self.config["ftintitle"]["keep_in_artist"] = keep_in_artist
|
||||
|
||||
def test_functional_drop(self):
|
||||
item = self._ft_add_item("/", "Alice ft Bob", "Song 1", "Alice")
|
||||
|
|
@ -82,6 +85,20 @@ class FtInTitlePluginFunctional(unittest.TestCase, TestHelper):
|
|||
self.assertEqual(item["artist"], "Alice")
|
||||
self.assertEqual(item["title"], "Song 1 with Bob")
|
||||
|
||||
def test_functional_keep_in_artist(self):
|
||||
self._ft_set_config("feat. {0}", keep_in_artist=True)
|
||||
item = self._ft_add_item("/", "Alice ft Bob", "Song 1", "Alice")
|
||||
self.run_command("ftintitle")
|
||||
item.load()
|
||||
self.assertEqual(item["artist"], "Alice ft Bob")
|
||||
self.assertEqual(item["title"], "Song 1 feat. Bob")
|
||||
|
||||
item = self._ft_add_item("/", "Alice ft Bob", "Song 1", "Alice")
|
||||
self.run_command("ftintitle", "-d")
|
||||
item.load()
|
||||
self.assertEqual(item["artist"], "Alice ft Bob")
|
||||
self.assertEqual(item["title"], "Song 1")
|
||||
|
||||
|
||||
class FtInTitlePluginTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue