1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-08-13 16:53:54 -04:00

Added encoding tests to test suite.

Possible fix for issue #1016 - Unicode decode/encode issues
This commit is contained in:
echel0n 2014-12-05 18:46:44 -08:00
parent 4dc20f2d99
commit b7a5fc85fe
2 changed files with 32 additions and 3 deletions

View File

@ -350,7 +350,8 @@ class MainHandler(RequestHandler):
sort = 'date'
if sickbeard.COMING_EPS_LAYOUT == 'calendar':
sort = 'date'
sort\
= 'date'
sickbeard.COMING_EPS_SORT = sort
@ -577,8 +578,7 @@ class IndexerWebUI(MainHandler):
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):
if show is None:

29
tests/encoding_tests.py Normal file
View 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)