Ejemplo n.º 1
0
 def test_returns_xml_content(self):
     try:
         content = get_http_content("http://tavil.ru/sitemap.xml")
     except Exception as e:
         content = False
     self.assertTrue(content)
     self.assertTrue(isinstance(content, str))
     self.assertTrue(len(content) > 100)
     self.assertTrue(".xml" in content)
Ejemplo n.º 2
0
 def test_incorrect_url(self):
     try:
         _ = get_http_content("abc")
     except SystemExit:
         _ = False
     self.assertFalse(_)
Ejemplo n.º 3
0
 def setUp(self):
     self.result = S.parse_xml(get_http_content('http://tavil.ru'))
Ejemplo n.º 4
0
 def test_bad_status_code(self):
     try:
         _ = get_http_content("http://yandex.ru/404/")
     except RequestException:
         _ = False
     self.assertFalse(_)