Ejemplo n.º 1
0
 def test_raise_NotHtmlException_on_messed_up_content_type(self):
     from eek.spider import beautify, NotHtmlException
     response = self.MockResponse('foo', '<!doctype html><p>Hello</p>')
     with self.assertRaises(NotHtmlException):
         beautify(response)
Ejemplo n.º 2
0
 def test_return_not_none_encoding(self):
     from eek.spider import beautify
     response = self.MockResponse('text/html; charset=utf-8',
                                  '<!doctype html><p>Hello</p>')
     result = beautify(response)
     self.assertIsNotNone(result.original_encoding)
Ejemplo n.º 3
0
 def test_return_no_encoding(self):
     from eek.spider import beautify
     response = self.MockResponse('text/html',
                                  '<!doctype html><p>Hello</p>')
     result = beautify(response)
     self.assertIsNone(result.fromEncoding)
Ejemplo n.º 4
0
 def test_raise_NotHtmlException_on_messed_up_content_type(self):
     from eek.spider import beautify, NotHtmlException
     response = self.MockResponse('foo',
                                  '<!doctype html><p>Hello</p>')
     with self.assertRaises(NotHtmlException):
         beautify(response)
Ejemplo n.º 5
0
 def test_return_not_none_encoding(self):
     from eek.spider import beautify
     response = self.MockResponse('text/html; charset=utf-8',
                                  '<!doctype html><p>Hello</p>')
     result = beautify(response)
     self.assertIsNotNone(result.original_encoding)
Ejemplo n.º 6
0
 def test_return_no_encoding(self):
     from eek.spider import beautify
     response = self.MockResponse('text/html',
                                  '<!doctype html><p>Hello</p>')
     result = beautify(response)
     self.assertIsNone(result.fromEncoding)