calendar: add expected context for search index to work (#19987)
This commit is contained in:
parent
8f9a22ca63
commit
1fff18760f
|
@ -53,5 +53,6 @@ class BookingCalendar(CellBase):
|
||||||
return is_chrono_enabled() and is_wcs_enabled()
|
return is_chrono_enabled() and is_wcs_enabled()
|
||||||
|
|
||||||
def render(self, context):
|
def render(self, context):
|
||||||
|
context.update(self.get_cell_extra_context(context))
|
||||||
context = add_paginated_calendar_to_context(context)
|
context = add_paginated_calendar_to_context(context)
|
||||||
return super(BookingCalendar, self).render(context)
|
return super(BookingCalendar, self).render(context)
|
||||||
|
|
|
@ -323,3 +323,13 @@ def test_cell_rendering_cal_info_when_no_available_slots(client, cell):
|
||||||
page = client.get('/booking/')
|
page = client.get('/booking/')
|
||||||
title_info = page.html.h2.find('span', {'class': 'calinfo'})
|
title_info = page.html.h2.find('span', {'class': 'calinfo'})
|
||||||
assert title_info.text.strip() == '(No available slots.)'
|
assert title_info.text.strip() == '(No available slots.)'
|
||||||
|
|
||||||
|
def test_booking_calendar_indexing(cell):
|
||||||
|
with mock.patch('combo.utils.requests.get') as request_get:
|
||||||
|
def side_effect(*args, **kwargs):
|
||||||
|
if 'chrono' in kwargs['remote_service']['url']:
|
||||||
|
return MockedRequestResponse(content=json.dumps({"data": []}))
|
||||||
|
return MockedRequestResponse(content=json.dumps(WCS_FORMDEFS))
|
||||||
|
request_get.side_effect = side_effect
|
||||||
|
search_text = cell.render_for_search()
|
||||||
|
assert 'Example Of Calendar' in search_text
|
||||||
|
|
Loading…
Reference in New Issue