source: products/quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/tests/testUtils.py @ 3223

Last change on this file since 3223 was 3223, checked in by vmaksymiv, 8 years ago

has added upgrade step for fixing escaped seo properties

File size: 1.4 KB
Line 
1# -*- coding: utf8 -*-
2from unittest import TestSuite, makeSuite, TestCase
3from quintagroup.seoptimizer.util import unescape
4
5
6class TestUtils(TestCase):
7
8    def test_unicode_str_unescaping(self):
9        self.assertEqual(unescape("&&-/["), "&&-/[")
10
11    def test_str_unescaping(self):
12        self.assertEqual(unescape("&&-/["), "&&-/[")
13
14    def test_entity_unicode_unescaping(self):
15        self.assertEqual(unescape(u"&&ї".encode('utf-8')),
16                                  u"&&ї".encode('utf-8'))
17
18    def test_hex_unescaping(self):
19        self.assertEqual(unescape('['), '[')
20
21    def test_simple_text_unescaping(self):
22        self.assertEqual(unescape("Simple text."), "Simple text.")
23
24    def test_entity_hex_unescaping(self):
25        self.assertEqual(unescape('['), '[')
26
27    def test_intity_dec_unescaping(self):
28        self.assertEqual(unescape('['), '[')
29
30    def test_entity_dec_hex_unescaping(self):
31        self.assertEqual(unescape('['), '[')
32
33    def test_fake_entity_unescaping(self):
34        self.assertEqual(unescape("&asd;"), "&asd;")
35
36    def test_aentity_unescaping(self):
37        self.assertEqual(unescape("—").encode('utf-8'),
38                         u"—".encode('utf-8'))
39
40
41def test_suite():
42    suite = TestSuite()
43    suite.addTest(makeSuite(TestUtils))
44    return suite
Note: See TracBrowser for help on using the repository browser.