def filtered_countries(self): response = cms_api_client.lookup_country_guides( industry=','.join(self.selected_sectors), region=','.join(self.selected_regions)) results = handle_cms_response_allow_404(response) return self.sort_results(results)
def page(self): response = cms_api_client.lookup_by_slug( slug=cms.GREAT_HOME_SLUG, draft_token=self.request.GET.get('draft_token'), ) return helpers.handle_cms_response_allow_404(response)
def test_handle_cms_response_allow_404_ok(): response = core.tests.helpers.create_response({'field': 'value'}) assert helpers.handle_cms_response_allow_404(response) == { 'field': 'value' }
def test_handle_cms_response_allow_404_not_found(): response = core.tests.helpers.create_response(status_code=404) assert helpers.handle_cms_response_allow_404(response) == {}
def test_handle_cms_response_allow_404_error(status_code, exception): response = core.tests.helpers.create_response(status_code=status_code) with pytest.raises(exception): helpers.handle_cms_response_allow_404(response)
def test_handle_cms_response_allow_404_ok(): response = core.tests.helpers.create_response(status_code=200, json_body={'field': 'value'}) assert helpers.handle_cms_response_allow_404(response) == { 'field': 'value' }