Exemple #1
0
 def test_succeed(self):
     responses.add(responses.GET, "http://google.com/robots.txt", status=200, body="Disallow: /failure")
     self.assertEqual(fetch_robots_txt("http://google.com/test.html"), "Disallow: /failure")
Exemple #2
0
 def test_fail(self):
     responses.add(responses.GET, "http://google.com/robots.txt", status=404)
     with self.assertRaises(requests.exceptions.RequestException):
         fetch_robots_txt("http://google.com/test.html")