mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-07 03:48:02 -05:00
Added encoding tests to test suite.
Possible fix for issue #1016 - Unicode decode/encode issues
This commit is contained in:
parent
4dc20f2d99
commit
b7a5fc85fe
@ -350,7 +350,8 @@ class MainHandler(RequestHandler):
|
|||||||
sort = 'date'
|
sort = 'date'
|
||||||
|
|
||||||
if sickbeard.COMING_EPS_LAYOUT == 'calendar':
|
if sickbeard.COMING_EPS_LAYOUT == 'calendar':
|
||||||
sort = 'date'
|
sort\
|
||||||
|
= 'date'
|
||||||
|
|
||||||
sickbeard.COMING_EPS_SORT = sort
|
sickbeard.COMING_EPS_SORT = sort
|
||||||
|
|
||||||
@ -577,8 +578,7 @@ class IndexerWebUI(MainHandler):
|
|||||||
|
|
||||||
|
|
||||||
def _munge(string):
|
def _munge(string):
|
||||||
return unicode(string).encode('utf-8', 'xmlcharrefreplace')
|
return ek.toUnicode(string).encode('utf-8', 'xmlcharrefreplace')
|
||||||
|
|
||||||
|
|
||||||
def _getEpisode(show, season=None, episode=None, absolute=None):
|
def _getEpisode(show, season=None, episode=None, absolute=None):
|
||||||
if show is None:
|
if show is None:
|
||||||
|
29
tests/encoding_tests.py
Normal file
29
tests/encoding_tests.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import unittest
|
||||||
|
#import test_lib as test
|
||||||
|
import sys, os.path
|
||||||
|
|
||||||
|
sys.path.append(os.path.abspath('..'))
|
||||||
|
sys.path.append(os.path.abspath('../lib'))
|
||||||
|
|
||||||
|
import sickbeard
|
||||||
|
from encodingKludge import toUnicode
|
||||||
|
from sickbeard.exceptions import ex
|
||||||
|
|
||||||
|
sickbeard.SYS_ENCODING = 'UTF-8'
|
||||||
|
|
||||||
|
DEBUG = VERBOSE = False
|
||||||
|
|
||||||
|
class EncodingTests(unittest.TestCase):
|
||||||
|
def test_encoding(self):
|
||||||
|
s = u'\x89'
|
||||||
|
try:
|
||||||
|
print toUnicode(s).encode('utf-8', 'xmlcharrefreplace')
|
||||||
|
except Exception, e:
|
||||||
|
print ex(e)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
print "=================="
|
||||||
|
print "STARTING - Encoding TESTS"
|
||||||
|
print "=================="
|
||||||
|
print "######################################################################"
|
||||||
|
suite = unittest.TestLoader().loadTestsFromTestCase(EncodingTests)
|
Loading…
Reference in New Issue
Block a user