Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    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')