Beispiel #1
0
 def get_contact_page(self):
     response = cms_api_client.lookup_by_slug(
         slug=slugs.FIND_A_SUPPLIER_INDUSTRY_CONTACT,
         language_code=translation.get_language(),
         draft_token=self.request.GET.get('draft_token'),
     )
     return handle_cms_response(response)
Beispiel #2
0
 def page(self):
     response = cms_api_client.lookup_by_slug(
         slug=slugs.GREAT_HOME,
         draft_token=self.request.GET.get('draft_token'),
     )
     return helpers.handle_cms_response(response)
Beispiel #3
0
 def sector_list(self):
     return helpers.handle_cms_response(cms_api_client.list_industry_tags())
def test_handle_cms_response_ok():
    response = core.tests.helpers.create_response({'field': 'value'})

    assert helpers.handle_cms_response(response) == {'field': 'value'}
def test_handle_cms_response_error(status_code, exception):
    response = core.tests.helpers.create_response(status_code=status_code)
    with pytest.raises(exception):
        helpers.handle_cms_response(response)
Beispiel #6
0
 def get_industry_page(self):
     response = cms_api_client.lookup_by_slug(
         slug=self.kwargs['slug'],
         language_code=translation.get_language(),
     )
     return handle_cms_response(response)
def test_handle_cms_response_ok():
    response = core.tests.helpers.create_response(status_code=200,
                                                  json_body={'field': 'value'})

    assert helpers.handle_cms_response(response) == {'field': 'value'}
Beispiel #8
0
 def page(self):
     response = cms_api_client.lookup_by_tag(
         slug=self.slug,
         draft_token=self.request.GET.get('draft_token'),
     )
     return handle_cms_response(response)
Beispiel #9
0
 def handle_cms_response(self, response):
     return helpers.handle_cms_response(response)
Beispiel #10
0
 def regions_list(self):
     return helpers.handle_cms_response(cms_api_client.list_regions())
Beispiel #11
0
 def items(self):
     response = cms_api_client.list_by_page_type(
         cms.FIND_A_SUPPLIER_INDUSTRY_TYPE)
     pages = helpers.handle_cms_response(response)['items']
     return [page['meta']['slug'] for page in pages]