def register_hal(uri='http://www.example.com/',
                 links=None,
                 state=None,
                 title=None,
                 method='GET',
                 headers=None,
                 status=200,
):

    def body_callback(_meth, req_uri, req_headers):
        '''This is either registered for dynamic uris or is called for a
        static uri'''
        _links = links.copy() if links is not None else {}
        _state = state.copy() if state is not None else {}
        if headers is not None:
            resp_headers = headers.copy()
        else:
            resp_headers = {}
        if req_headers is not None:
            resp_headers.update(req_headers)
        resp_headers.update({'server': 'HTTPretty 0.6.0'})
        _links.update({'self': {'href': req_uri}})
        if title is not None:
            _links['self']['title'] = title
        _state.update({'_links': _links})
        return status, resp_headers, json.dumps(_state)

    httpretty.HTTPretty.register_uri(method=method,
                                     body=body_callback,
                                     content_type='application/hal+json',
                                     uri=uri)
Convenience function that registers a hal document at a given address
dataset/ETHPy150Open deontologician/restnavigator/tests/test_hal_nav.py/register_hal