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)
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)
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)