httpretty function response code example
Example: httpretty function response
def setup_http_server():
url_projects = read_file(URL_PROJECTS_FILE)
http_requests = []
def request_callback(method, uri, headers):
last_request = httpretty.last_request()
body = url_projects
http_requests.append(last_request)
return 200, headers, body
httpretty.register_uri(httpretty.GET,
PROJECTS_URL,
responses=[
httpretty.Response(body=request_callback)
])
return http_requests