def test__process_tracks_no_track(self): """Test _process_tracks method with no track in media info file.""" # set new mocks to eradicate interference with other usage MOCK_MediaInfoFetcher = mock.MagicMock() MOCK_MediaInfoFetcher.media_info = {'media': OrderedDict()} with self.assertRaises(InvalidMediaInfoError): MediaInfoFetcher._process_tracks(MOCK_MediaInfoFetcher)
def test__process_tracks_file_key_error(self): """Test _process_tracks method with key error in self.media_info.""" # set new mocks to eradicate interference with other usage MOCK_MediaInfoFetcher = mock.MagicMock() MOCK_MediaInfoFetcher.media_info = {} with self.assertRaises(InvalidMediaInfoError): MediaInfoFetcher._process_tracks(MOCK_MediaInfoFetcher)
def test__process_tracks(self): """Test _process_tracks method with valid information.""" # set new mocks to eradicate interference with other usage MOCK_MediaInfoFetcher = mock.MagicMock() MOCK_MediaInfoFetcher.media_info = {'media': OrderedDict([('track', ['track1'])])} MediaInfoFetcher._process_tracks(MOCK_MediaInfoFetcher) MOCK_MediaInfoFetcher._process_track.assert_called_once_with('track1')