wcs: add site slug attribute to all items (#20374)

This commit is contained in:
Frédéric Péters 2018-01-03 17:03:24 +01:00
parent 7ab32ab4f1
commit a129bda7c9
2 changed files with 7 additions and 0 deletions

View File

@ -192,6 +192,9 @@ class WcsBlurpMixin(object):
wcs_site['data'] = json_response
elif json_response.get('err', 0) == 0:
wcs_site['data'] = json_response['data']
# and mark all items with the site info
for item in wcs_site['data']:
item['site_slug'] = wcs_slug
if not 200 in returns: # not a single valid answer
logging.error('failed to get data from any %s (%r)', self.api_url, returns)

View File

@ -342,6 +342,10 @@ def test_current_forms_cell_render(context):
assert not 'http://127.0.0.1:8999/form-title/1/' in result
assert 'http://127.0.0.1:8999/form-title/8/' in result
data = cell.get_data(context)
assert data['default']['data'][0]['site_slug'] == 'default'
assert data['other']['data'][0]['site_slug'] == 'other'
@wcsctl_present
def test_current_forms_cell_render_single_site(context):
page = Page(title='xxx', slug='test_current_forms_cell_render', template_name='standard')