'Helper method that calls the endpoint, verifies the expected response code, and returns the response.
Arguments:
expected_response_code: The expected response code.
url_params: URL parameters that will be encoded and passed to the request.'

def verify_response(self, expected_response_code=200, url_params=None):

    if url_params:
        url_params = urlencode(url_params)
    response = self.get_response(self.block_to_be_tested.location, url_params)
    if (expected_response_code == 200):
        self.assertContains(response, self.html_block.data, status_code=expected_response_code)
        unexpected_elements = self.block_specific_chrome_html_elements
        unexpected_elements += (self.COURSEWARE_CHROME_HTML_ELEMENTS + self.XBLOCK_REMOVED_HTML_ELEMENTS)
        for chrome_element in unexpected_elements:
            self.assertNotContains(response, chrome_element)
    else:
        self.assertNotContains(response, self.html_block.data, status_code=expected_response_code)
    return response
