示例#1
0
文件: error.py 项目: taftsanders/pulp
def http_error_obj(http_status, msg=None):
    """
    Serialize an http error.
    @param http_status: valid http status number
    @type http_status: int
    @param msg: error message
    @type: str
    @return: serialized error
    @rtype: dict
    """
    error_obj = copy.copy(_ERROR_OBJ_SKEL)
    error_obj['http_request_method'] = request_method()
    error_obj['http_status'] = http_status
    error_obj['error_message'] = msg
    error_obj.update(link.current_link_obj())
    return error_obj
示例#2
0
 def test_current_link_obj(self, mock_path):
     ret = link.current_link_obj()
     self.assertEqual(ret, {'_href': '/base/uri/repo1/'})
 def test_current_link_obj(self, mock_path):
     ret = link.current_link_obj()
     self.assertEqual(ret, {'_href': '/base/uri/repo1/'})