Projet

Général

Profil

0001-wcs-fix-repeat_index-in-context-in-card-cell-60885.patch

Lauréline Guérin, 20 janvier 2022 16:36

Télécharger (1,74 ko)

Voir les différences:

Subject: [PATCH] wcs: fix repeat_index in context in card cell (#60885)

 combo/apps/wcs/models.py | 3 ++-
 tests/test_wcs.py        | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)
combo/apps/wcs/models.py
1272 1272
        extra_context['card'] = card_data
1273 1273
        custom_context = Context(extra_context)
1274 1274
        custom_context.update(context)
1275
        custom_context['repeat_index'] = context.get('repeat_index') or 0
1275
        repeat_index = getattr(self, 'repeat_index', context.get('repeat_index')) or 0
1276
        custom_context['repeat_index'] = repeat_index
1276 1277
        if self.title_type == 'manual':
1277 1278
            try:
1278 1279
                extra_context['title'] = Template(self.custom_title).render(custom_context)
tests/test_wcs.py
2367 2367
    for i in range(0, 3):
2368 2368
        cell_resp = app.get(cell_url + '?ctx=' + extra_ctx[i])
2369 2369
        assert '<h2>Foo bar X%sY</h2>' % i in cell_resp
2370
    # again, without ajax: urls are already in cache
2371
    resp = app.get(page.get_online_url())
2372
    assert len(resp.context['cells']) == 3
2373
    for i in range(0, 3):
2374
        assert '<h2>Foo bar X%sY</h2>' % i in resp
2370 2375

  
2371 2376

  
2372 2377
@mock.patch('combo.apps.wcs.utils.requests.send', side_effect=mocked_requests_send)
2373
-