1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 12:15:40 +01:00
svtplay-dl/lib/svtplay_dl/tests/hls.py
Olof Johansson 5393dc1929 Fix various pylint warnings
None of these were any real problems, but easier to spot real issues if pylint
is a bit quieter. Apart from the pylint overrides being sprinkled over the code
base, this commit also fixes occurences of the following issues:

 - logging-not-lazy
 - logging-format-interpolation
 - unused-import
 - unused-variable
2016-04-03 19:06:45 +02:00

59 lines
1.9 KiB
Python

#!/usr/bin/python
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
# The unittest framwork doesn't play nice with pylint:
# pylint: disable-msg=C0103
# We're a test, we go where ever we want (within reason, of course):
# pylint: disable-msg=protected-access
from __future__ import absolute_import
import unittest
import svtplay_dl.fetcher.hls as hls
class HlsTest(unittest.TestCase):
def test_get_full_url_1(self):
for test in [
# full http:// url as media segment in playlist
{
'srcurl': 'INVALID',
'segment': 'http://example.com/',
'expected': 'http://example.com/'
},
# full https:// url as media segment in playlist
{
'srcurl': 'INVALID',
'segment': 'https://example.com/',
'expected': 'https://example.com/'
},
# filename as media segment in playlist (http)
{
'srcurl': 'http://example.com/',
'segment': 'foo.ts',
'expected': 'http://example.com/foo.ts'
},
# filename as media segment in playlist (https)
{
'srcurl': 'https://example.com/',
'segment': 'foo.ts',
'expected': 'https://example.com/foo.ts'
},
# replacing srcurl file
{
'srcurl': 'http://example.com/bar',
'segment': 'foo.ts',
'expected': 'http://example.com/foo.ts'
},
# with query parameters
{
'srcurl': 'http://example.com/bar?baz=qux',
'segment': 'foo.ts',
'expected': 'http://example.com/foo.ts'
},
]:
self.assertEqual(
hls._get_full_url(test['segment'], test['srcurl']),
test['expected'])