本文整理汇总了Python中splinter.request_handler.request_handler.RequestHandler.ensure_success_response方法的典型用法代码示例。如果您正苦于以下问题:Python RequestHandler.ensure_success_response方法的具体用法?Python RequestHandler.ensure_success_response怎么用?Python RequestHandler.ensure_success_response使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类splinter.request_handler.request_handler.RequestHandler
的用法示例。
在下文中一共展示了RequestHandler.ensure_success_response方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_should_get_an_exception_and_format_it
# 需要导入模块: from splinter.request_handler.request_handler import RequestHandler [as 别名]
# 或者: from splinter.request_handler.request_handler.RequestHandler import ensure_success_response [as 别名]
def test_should_get_an_exception_and_format_it(self):
request = RequestHandler()
request.connect(EXAMPLE_APP + "page-that-doesnt-exists")
try:
request.ensure_success_response()
except HttpResponseError as e:
exception = e.msg
self.assertEqual("404 - Not Found", exception)
示例2: test_should_get_an_exception_and_format_it_using_the_exception_attrs
# 需要导入模块: from splinter.request_handler.request_handler import RequestHandler [as 别名]
# 或者: from splinter.request_handler.request_handler.RequestHandler import ensure_success_response [as 别名]
def test_should_get_an_exception_and_format_it_using_the_exception_attrs(self):
request = RequestHandler()
request.connect(EXAMPLE_APP + "page-that-doesnt-exists")
try:
request.ensure_success_response()
except HttpResponseError as e:
exception = "I failed with code %d and reason %s" % (e.status_code, e.reason)
assert_equals(exception, "I failed with code 404 and reason Not Found")
示例3: test_should_get_an_absent_url_and_raise_an_exception
# 需要导入模块: from splinter.request_handler.request_handler import RequestHandler [as 别名]
# 或者: from splinter.request_handler.request_handler.RequestHandler import ensure_success_response [as 别名]
def test_should_get_an_absent_url_and_raise_an_exception(self):
with self.assertRaises(HttpResponseError):
request = RequestHandler()
request.connect(EXAMPLE_APP + "page-that-doesnt-exists")
request.ensure_success_response()