forked from Flexget/Flexget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_urlfix.py
27 lines (23 loc) · 956 Bytes
/
test_urlfix.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from __future__ import unicode_literals, division, absolute_import
from tests import FlexGetBase
class TestUrlfix(FlexGetBase):
__yaml__ = """
tasks:
test:
mock:
- {title: 'Test', url: 'http://localhost/foo?bar=asdf&xxx=yyy'}
test2:
mock:
- {title: 'Test', url: 'http://localhost/foo?bar=asdf&xxx=yyy'}
urlfix: no
"""
def test_urlfix(self):
self.execute_task('test')
entry = self.task.find_entry('entries', title='Test')
assert entry['url'] == 'http://localhost/foo?bar=asdf&xxx=yyy', \
'failed to auto fix url, got %s' % entry['url']
def test_urlfix_disabled(self):
self.execute_task('test2')
entry = self.task.find_entry('entries', title='Test')
assert entry['url'] != 'http://localhost/foo?bar=asdf&xxx=yyy', \
'fixed even when disabled, got %s' % entry['url']