def test_filmon_expired_stream(self, url, time): stream = FilmOnHLS(self.session, channel="test") url.return_value = "http://filmon.test.se/test.m3u8" stream.watch_timeout = 0 time.return_value = 1 self.assertEqual(None, stream_to_url(stream)) self.assertRaises(TypeError, stream.to_url)
def test_filmon_stream(self, url, time): stream = FilmOnHLS(self.session, channel="test") url.return_value = "http://filmon.test.se/test.m3u8" stream.watch_timeout = 10 time.return_value = 1 expected = "http://filmon.test.se/test.m3u8" self.assertEqual(expected, stream_to_url(stream)) self.assertEqual(expected, stream.to_url())
def filmonhls(): with freezegun.freeze_time(datetime.datetime(2000, 1, 1, 0, 0, 0, 0)), \ patch("streamlink.plugins.filmon.FilmOnHLS._get_stream_data", return_value=[]): session = Streamlink() api = FilmOnAPI(session) yield FilmOnHLS(session, "http://fake/one.m3u8", api=api, channel="test")
def filmonhls(): with freezegun.freeze_time(datetime.datetime(2000, 1, 1, 0, 0, 0, 0)), \ patch("streamlink.plugins.filmon.FilmOnHLS.url", new_callable=PropertyMock) as url: url.return_value = "http://filmon.tv/test.m3u8" session = Streamlink() yield FilmOnHLS(session, channel="test")