mirror of
https://github.com/beetbox/beets.git
synced 2026-01-07 00:15:20 +01:00
Add last 2 tests -- 100% line coverage
This commit is contained in:
parent
4a1a70e23d
commit
7f372a6a59
1 changed files with 15 additions and 1 deletions
|
|
@ -10,8 +10,9 @@ import os
|
|||
from mock import patch, ANY
|
||||
|
||||
from test._common import unittest
|
||||
from test.helper import TestHelper
|
||||
from test.helper import TestHelper, control_stdin
|
||||
|
||||
from beets.ui import UserError
|
||||
|
||||
@patch('beetsplug.play.util.interactive_open')
|
||||
class PlayPluginTest(unittest.TestCase, TestHelper):
|
||||
|
|
@ -79,6 +80,19 @@ class PlayPluginTest(unittest.TestCase, TestHelper):
|
|||
self.run_command('play', 'not found')
|
||||
open_mock.assert_not_called()
|
||||
|
||||
def test_warning_threshold(self, open_mock):
|
||||
self.config['play']['warning_treshold'] = 1
|
||||
item2 = self.add_item(title='another NiceTitle')
|
||||
with control_stdin("a"):
|
||||
self.run_command('play', 'nice')
|
||||
|
||||
open_mock.assert_not_called()
|
||||
|
||||
def test_command_failed(self, open_mock):
|
||||
open_mock.side_effect = OSError("some reason")
|
||||
with self.assertRaises(UserError):
|
||||
self.run_command('play', 'title:aNiceTitle')
|
||||
|
||||
def assertPlaylistCorrect(self, open_mock, expected='{}\n'):
|
||||
playlist = open(open_mock.call_args[0][0][0], 'r')
|
||||
self.assertEqual(expected.format(self.item.path.decode('utf-8')),
|
||||
|
|
|
|||
Loading…
Reference in a new issue