def test_hge_restlib_exception_formated_msg(self): utils.log.set_expected_msg(self.msg) utils.handle_gui_exception( connection.RestlibException(409, "very clean"), self.formatted_msg, None) self.assertEqual(utils.log.expected_msg, self.msg)
def test_hge_restlib_exception_url_msg(self): utils.log.set_expected_msg(self.msg) utils.handle_gui_exception( connection.RestlibException(404, "page not found"), self.msg_with_url, None) self.assertEqual(utils.log.expected_msg, self.msg)
def stub_unbind(uuid, pool_id): if pool_id == 'does_not_exist_d015dea0adf560152': raise connection.RestlibException(400, 'Error')
def stub_unbind(uuid, serial): if serial == 'does_not_exist_1394': raise connection.RestlibException(400, 'Error')
def test_hge_restlib_exception_url_msg_500(self): utils.handle_gui_exception(connection.RestlibException(500, "internal server error"), self.msg_with_url, None, format_msg=True)
def test_he_restlib_exception(self): e = connection.RestlibException(404, "this is a msg") try: managercli.handle_exception("huh", e) except SystemExit, e: self.assertEquals(e.code, -1)
def test_hge_restlib_exception_url_msg_with_formatting_format_msg_false(self): utils.handle_gui_exception(connection.RestlibException(404, "page not found"), self.msg_with_url_and_formatting, None, format_msg=False)
def test_hge_restlib_exception_unformatted_msg_format_msg_false(self): utils.log.set_expected_msg(self.msg) utils.handle_gui_exception(connection.RestlibException(421, "whatever"), self.msg, None, format_msg=False)
def test_hge_restlib_exception_unformatted_msg(self): utils.log.set_expected_msg(self.msg) utils.handle_gui_exception(connection.RestlibException(421, "whatever"), self.msg, None) self.assertEqual(utils.log.expected_msg, self.msg)
def stub_unbind(uuid, serial): if serial == "does_not_exist_1394": raise connection.RestlibException(400, "Error")
def test_he_restlib_exception(self): e = connection.RestlibException(404, "this is a msg") try: handle_exception("huh", e) except SystemExit as e: self.assertEqual(e.code, os.EX_SOFTWARE)