From d15b996dc4a741390507a96d6facf113f8da0869 Mon Sep 17 00:00:00 2001 From: Jesse Weinstein Date: Sat, 2 Jan 2016 22:33:36 -0800 Subject: [PATCH] Verify that the generated playlist contains the path to the item --- test/test_play.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/test_play.py b/test/test_play.py index 68d8c2ea8..f1f1ba3ab 100644 --- a/test/test_play.py +++ b/test/test_play.py @@ -5,7 +5,7 @@ from __future__ import (division, absolute_import, print_function, unicode_literals) -from mock import patch, Mock +from mock import patch, ANY from test._common import unittest from test.helper import TestHelper @@ -15,16 +15,21 @@ class PlayPluginTest(unittest.TestCase, TestHelper): def setUp(self): self.setup_beets() self.load_plugins('play') - self.add_item(title='aNiceTitle') + self.item = self.add_item(title='aNiceTitle') def tearDown(self): self.teardown_beets() self.unload_plugins() - @patch('beetsplug.play.util.interactive_open', Mock()) - def test_basic(self): + @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) + playlist = open(open_mock.call_args[0][0][0], 'r') + self.assertEqual(self.item.path.decode('utf-8') + '\n', + playlist.read().decode('utf-8')) + def suite(): return unittest.TestLoader().loadTestsFromName(__name__)