def test_url_redirect(url, newurl, raises): VK.bind(Mock(), "tests.plugins.test_vk") plugin = VK(url) try: plugin.follow_vk_redirect() assert not raises except NoStreamsError: assert raises assert plugin.url == newurl
def test_url_redirect(url, newurl, raises, requests_mock): session = Streamlink() VK.bind(session, "tests.plugins.test_vk") plugin = VK(url) requests_mock.register_uri(rm.ANY, rm.ANY, exc=rm.exceptions.InvalidRequest) requests_mock.get( url, text= f"""<!DOCTYPE html><html><head><meta property="og:url" content="{newurl}"/></head></html>""" ) try: plugin.follow_vk_redirect() assert not raises assert plugin.url == newurl except NoStreamsError: assert raises