Exemplo n.º 1
0
    def test_scan_fails_but_playlist_parsing_succeeds(
        self, scanner, provider, caplog
    ):

        caplog.set_level(logging.DEBUG)
        scanner.scan.side_effect = [
            # Scanning playlist
            exceptions.ScannerError("some failure"),
            # Scanning stream
            mock.Mock(mime="audio/mpeg", playable=True),
        ]
        responses.add(
            responses.GET,
            PLAYLIST_URI,
            body=BODY,
            content_type="audio/x-mpegurl",
        )

        result = provider.translate_uri(PLAYLIST_URI)

        assert f"Unwrapping stream from URI: {PLAYLIST_URI}" in caplog.text
        assert f"GStreamer failed scanning URI ({PLAYLIST_URI})" in caplog.text
        assert f"Parsed playlist ({PLAYLIST_URI})" in caplog.text
        assert (
            f"Unwrapped potential audio/mpeg stream: {STREAM_URI}"
            in caplog.text
        )
        assert result == STREAM_URI
Exemplo n.º 2
0
    def test_scan_fails_and_playlist_parsing_fails(self, scanner, provider,
                                                   caplog):

        scanner.scan.side_effect = exceptions.ScannerError('some failure')
        responses.add(responses.GET,
                      STREAM_URI,
                      body=b'some audio data',
                      content_type='audio/mpeg')

        result = provider.translate_uri(STREAM_URI)

        assert 'Unwrapping stream from URI: %s' % STREAM_URI
        assert ('GStreamer failed scanning URI (%s)' % STREAM_URI
                in caplog.text())
        assert (
            'Failed parsing URI (%s) as playlist; found potential stream.' %
            STREAM_URI in caplog.text())
        assert result == STREAM_URI
Exemplo n.º 3
0
    def test_scan_fails_and_playlist_parsing_fails(
        self, scanner, provider, caplog
    ):

        caplog.set_level(logging.DEBUG)
        scanner.scan.side_effect = exceptions.ScannerError("some failure")
        responses.add(
            responses.GET,
            STREAM_URI,
            body=b"some audio data",
            content_type="audio/mpeg",
        )

        result = provider.translate_uri(STREAM_URI)

        assert f"Unwrapping stream from URI: {STREAM_URI}" in caplog.text
        assert f"GStreamer failed scanning URI ({STREAM_URI})" in caplog.text
        assert (
            f"Failed parsing URI ({STREAM_URI}) as playlist; found potential stream."
            in caplog.text
        )
        assert result == STREAM_URI
Exemplo n.º 4
0
    def test_scan_fails_but_playlist_parsing_succeeds(self, scanner, provider,
                                                      caplog):

        scanner.scan.side_effect = [
            # Scanning playlist
            exceptions.ScannerError('some failure'),
            # Scanning stream
            mock.Mock(mime='audio/mpeg', playable=True),
        ]
        responses.add(responses.GET,
                      PLAYLIST_URI,
                      body=BODY,
                      content_type='audio/x-mpegurl')

        result = provider.translate_uri(PLAYLIST_URI)

        assert 'Unwrapping stream from URI: %s' % PLAYLIST_URI
        assert ('GStreamer failed scanning URI (%s)' % PLAYLIST_URI
                in caplog.text())
        assert 'Parsed playlist (%s)' % PLAYLIST_URI in caplog.text()
        assert ('Unwrapped potential audio/mpeg stream: %s' % STREAM_URI
                in caplog.text())
        assert result == STREAM_URI