mirror of
https://github.com/beetbox/beets.git
synced 2025-12-24 01:25:47 +01:00
revert changes to working version with external mock
This commit is contained in:
parent
29a8eef281
commit
18bfefece7
1 changed files with 23 additions and 13 deletions
|
|
@ -20,8 +20,8 @@ from __future__ import division, absolute_import, print_function
|
|||
import os
|
||||
import unittest
|
||||
from test.helper import TestHelper
|
||||
#from mock import Mock
|
||||
#import musicbrainzngs
|
||||
from mock import Mock
|
||||
import musicbrainzngs
|
||||
|
||||
from beets.library import Item
|
||||
from beetsplug import parentwork
|
||||
|
|
@ -56,6 +56,16 @@ p_work = {'work': {'id': '3',
|
|||
'sort-name':
|
||||
'composer, random'}}]}}
|
||||
|
||||
def mock_workid_response(mbid, includes):
|
||||
if mbid == '1':
|
||||
return work
|
||||
elif mbid == '2':
|
||||
return dp_work
|
||||
elif mbid == '3':
|
||||
return p_work
|
||||
|
||||
|
||||
|
||||
|
||||
class ParentWorkIntegrationTest(unittest.TestCase, TestHelper):
|
||||
def setUp(self):
|
||||
|
|
@ -137,22 +147,22 @@ class ParentWorkTest(unittest.TestCase, TestHelper):
|
|||
"""Set up configuration"""
|
||||
self.setup_beets()
|
||||
self.load_plugins('parentwork')
|
||||
self.patcher1 = unittest.mock.patch('musicbrainzngs.get_work_by_id')
|
||||
self.mock_workid_response = self.patcher1.start()
|
||||
#musicbrainzngs.get_work_by_id = Mock(side_effect=mock_workid_response)
|
||||
#self.patcher1 = unittest.mock.patch('musicbrainzngs.get_work_by_id')
|
||||
#self.mock_workid_response = self.patcher1.start()
|
||||
musicbrainzngs.get_work_by_id = Mock(side_effect=mock_workid_response)
|
||||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
self.patcher1.stop()
|
||||
#self.patcher1.stop()
|
||||
|
||||
def mock_workid_response(self, mbid, includes):
|
||||
if mbid == '1':
|
||||
return work
|
||||
elif mbid == '2':
|
||||
return dp_work
|
||||
elif mbid == '3':
|
||||
return p_work
|
||||
#def mock_workid_response(self, mbid, includes):
|
||||
# if mbid == '1':
|
||||
# return work
|
||||
# elif mbid == '2':
|
||||
# return dp_work
|
||||
# elif mbid == '3':
|
||||
# return p_work
|
||||
|
||||
def test_normal_case(self):
|
||||
item = Item(path='/file', mb_workid='1', parentwork_workid_current='1')
|
||||
|
|
|
|||
Loading…
Reference in a new issue