From 6ad0c8a490f87cb46899f0a1c11ca6e4000c2afb Mon Sep 17 00:00:00 2001 From: Jesse Weinstein Date: Sun, 3 Jan 2016 00:05:49 -0800 Subject: [PATCH] Add album option test --- test/test_play.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/test_play.py b/test/test_play.py index 07bf64c0d..d007978f4 100644 --- a/test/test_play.py +++ b/test/test_play.py @@ -11,24 +11,30 @@ from test._common import unittest from test.helper import TestHelper +@patch('beetsplug.play.util.interactive_open') class PlayPluginTest(unittest.TestCase, TestHelper): def setUp(self): self.setup_beets() self.load_plugins('play') - self.item = self.add_item(title='aNiceTitle') + self.item = self.add_item(album='a nice älbum', title='aNiceTitle') + self.lib.add_album([self.item]) def tearDown(self): self.teardown_beets() self.unload_plugins() - @patch('beetsplug.play.util.interactive_open') def test_basic(self, open_mock): self.run_command('play', 'title:aNiceTitle') open_mock.assert_called_once_with(ANY, None) self.assertPlaylistCorrect(open_mock) - @patch('beetsplug.play.util.interactive_open') + def test_album_option(self, open_mock): + self.run_command('play', '-a', 'nice') + + open_mock.assert_called_once_with(ANY, None) + self.assertPlaylistCorrect(open_mock) + def test_args_option(self, open_mock): self.config['play']['command'] = 'echo' self.run_command('play', '-A', 'foo', 'title:aNiceTitle') @@ -36,7 +42,6 @@ class PlayPluginTest(unittest.TestCase, TestHelper): open_mock.assert_called_once_with(ANY, 'echo foo') self.assertPlaylistCorrect(open_mock) - @patch('beetsplug.play.util.interactive_open') def test_args_option_in_middle(self, open_mock): self.config['play']['command'] = 'echo $args other' self.run_command('play', '-A', 'foo', 'title:aNiceTitle') @@ -44,7 +49,6 @@ class PlayPluginTest(unittest.TestCase, TestHelper): open_mock.assert_called_once_with(ANY, 'echo foo other') self.assertPlaylistCorrect(open_mock) - @patch('beetsplug.play.util.interactive_open') def test_relative_to(self, open_mock): self.config['play']['command'] = 'echo' self.config['play']['relative_to'] = '/something'