def test_dash_stream(session): mpd = Mock(url=None) stream = DASHStream(session, mpd) with pytest.raises(TypeError) as cm: stream.to_url() assert str(cm.value) == "<DASHStream [dash]> cannot be translated to a URL" with pytest.raises(TypeError) as cm: stream.to_manifest_url() assert str( cm.value ) == "<DASHStream [dash]> cannot be translated to a manifest URL"
def test_dash_stream_url(session, common_args): # DASHStream requires an MPD instance as input: # The URL of the MPD instance was already prepared by DASHStream.parse_manifest, so copy this behavior here. # This test verifies that session params are added to the URL, without duplicates. args = common_args.copy() args.update(url="http://host/stream.mpd?foo=bar") url = session.http.prepare_new_request(**args).url mpd = Mock(url=url) stream = DASHStream(session, mpd, **common_args) assert stream.to_url( ) == "http://host/stream.mpd?foo=bar&queryparamkey=queryparamval" with pytest.raises(TypeError) as cm: stream.to_manifest_url() assert str( cm.value ) == "<DASHStream [dash]> cannot be translated to a manifest URL"