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)
def test_incorrect_url(self): try: _ = get_http_content("abc") except SystemExit: _ = False self.assertFalse(_)
def setUp(self): self.result = S.parse_xml(get_http_content('http://tavil.ru'))
def test_bad_status_code(self): try: _ = get_http_content("http://yandex.ru/404/") except RequestException: _ = False self.assertFalse(_)