summaryrefslogtreecommitdiff
path: root/unit_tests
diff options
context:
space:
mode:
authorPhilip Jenvey <pjenvey@underboss.org>2010-01-21 21:01:53 -0800
committerPhilip Jenvey <pjenvey@underboss.org>2010-01-21 21:01:53 -0800
commit1db2344f2985ae62217770e8297635733c4266df (patch)
treef4a09a766707a2a82083171337e3974ab458d581 /unit_tests
parent41b5c93b246042c72f34cd459b9cf3e614b2c02d (diff)
downloadnose-1db2344f2985ae62217770e8297635733c4266df.tar.gz
prevent the xunit XML from containing invalid control characters
Diffstat (limited to 'unit_tests')
-rw-r--r--unit_tests/test_xunit.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/unit_tests/test_xunit.py b/unit_tests/test_xunit.py
index a4cde1e..febd7a1 100644
--- a/unit_tests/test_xunit.py
+++ b/unit_tests/test_xunit.py
@@ -4,7 +4,7 @@ import os
import optparse
import unittest
from nose.tools import eq_
-from nose.plugins.xunit import Xunit
+from nose.plugins.xunit import Xunit, escape_cdata
from nose.exc import SkipTest
from nose.config import Config
@@ -32,7 +32,6 @@ class TestEscaping(unittest.TestCase):
eq_(self.x._quoteattr(u'Ivan Krsti\u0107'),
'"Ivan Krsti\xc4\x87"')
-
def test_unicode_custom_utf16_madness(self):
self.x.encoding = 'utf-16'
utf16 = self.x._quoteattr(u'Ivan Krsti\u0107')[1:-1]
@@ -40,6 +39,10 @@ class TestEscaping(unittest.TestCase):
# to avoid big/little endian bytes, assert that we can put it back:
eq_(utf16.decode('utf16'), u'Ivan Krsti\u0107')
+ def test_control_characters(self):
+ eq_(self.x._quoteattr('foo\n\b\f\r'), '"foo&#10;??&#13;"')
+ eq_(escape_cdata('foo\n\b\f\r'), 'foo\n??\r')
+
class TestOptions(unittest.TestCase):
def test_defaults(self):