tests: remove Django 2 compatibility code (#75442)
gitea/chrono/pipeline/head This commit looks good Details

This commit is contained in:
Valentin Deniaud 2023-03-15 14:21:41 +01:00
parent 04b405ba3d
commit 66dd82118e
5 changed files with 40 additions and 63 deletions

View File

@ -1,4 +1,3 @@
import django
import django_webtest
import pytest
@ -24,22 +23,3 @@ def nocache(settings):
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
@pytest.fixture
def get_proper_html_str():
"""
There are some subtle differences in the HTML generated by django 2 and 3
making it harder to write tests compatible with both versions.
XXX: remove when django 2 compat isn't necessary.
"""
def inner(s):
if django.VERSION[0] == 2:
return s.replace(''', ''')
if django.VERSION[0] == 3:
return s.replace(''', ''')
return s
return inner

View File

@ -891,7 +891,7 @@ def test_add_meetings_agenda(app, admin_user):
assert agenda.kind == 'meetings'
def test_agenda_day_view(app, admin_user, manager_user, api_user, get_proper_html_str):
def test_agenda_day_view(app, admin_user, manager_user, api_user):
agenda = Agenda.objects.create(label='New Example', kind='meetings')
desk = Desk.objects.create(agenda=agenda, label='New Desk')
desk.save()
@ -941,7 +941,7 @@ def test_agenda_day_view(app, admin_user, manager_user, api_user, get_proper_htm
assert resp.text.count('div class="booking') == 2
assert resp.pyquery.find('div.booking a').not_('.cancel')[0].text.strip() == 'booked'
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "foo - bar's"
assert get_proper_html_str('foo - bar's') in resp
assert 'foo - bar's' in resp
assert 'hourspan-2' in resp.text # table CSS class
assert 'height: 50%; top: 0%;' in resp.text # booking cells
@ -950,7 +950,7 @@ def test_agenda_day_view(app, admin_user, manager_user, api_user, get_proper_htm
resp = app.get('/manage/agendas/%s/day/%d/%d/%d/' % (agenda.id, date.year, date.month, date.day))
assert resp.pyquery.find('div.booking a').not_('.cancel')[0].text.strip() == '<b></b> Foo Bar'
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "<b>bar's</b> Foo Bar"
assert get_proper_html_str('&lt;b&gt;bar&#39;s&lt;/b&gt; Foo Bar') in resp
assert '&lt;b&gt;bar&#x27;s&lt;/b&gt; Foo Bar' in resp
# create a shorter meeting type, this will change the table CSS class
# (and visually this will give more room for events)
@ -1553,7 +1553,7 @@ def test_agenda_open_events_view(app, admin_user, manager_user):
app.get('/manage/agendas/%s/events/open/' % agenda.pk, status=404)
def test_agenda_month_view(app, admin_user, manager_user, api_user, get_proper_html_str):
def test_agenda_month_view(app, admin_user, manager_user, api_user):
agenda = Agenda.objects.create(label='Passeports', kind='meetings')
desk = Desk.objects.create(agenda=agenda, label='Desk A')
today = datetime.date.today()
@ -1609,7 +1609,7 @@ def test_agenda_month_view(app, admin_user, manager_user, api_user, get_proper_h
assert resp.text.count('<div class="booking" style="left:1.0%;height:33.0%;') == 2 # booking cells
assert resp.pyquery.find('div.booking a').not_('.cancel')[0].text.strip() == 'booked'
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "foo book - bar's"
assert get_proper_html_str('foo book - bar&#39;s') in resp
assert 'foo book - bar&#x27;s' in resp
assert len(resp.pyquery.find('span.desk')) == 0
agenda.booking_user_block_template = '<b>{{ booking.user_name }}</b> Foo Bar'
@ -1617,7 +1617,7 @@ def test_agenda_month_view(app, admin_user, manager_user, api_user, get_proper_h
resp = app.get('/manage/agendas/%s/month/%s/%s/%s/' % (agenda.pk, date.year, date.month, date.day))
assert resp.pyquery.find('div.booking a').not_('.cancel')[0].text.strip() == '<b></b> Foo Bar'
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "<b>bar's</b> Foo Bar"
assert get_proper_html_str('&lt;b&gt;bar&#39;s&lt;/b&gt; Foo Bar') in resp
assert '&lt;b&gt;bar&#x27;s&lt;/b&gt; Foo Bar' in resp
desk = Desk.objects.create(agenda=agenda, label='Desk B')
resp = app.get('/manage/agendas/%s/month/%s/%s/%s/' % (agenda.pk, date.year, date.month, date.day))
@ -1961,7 +1961,7 @@ def test_agenda_month_view_event_outside_timeperiod(app, admin_user, kind):
assert 'Saturday' in resp.text
def test_agenda_week_view(app, admin_user, manager_user, api_user, get_proper_html_str):
def test_agenda_week_view(app, admin_user, manager_user, api_user):
agenda = Agenda.objects.create(label='Passeports', kind='meetings')
desk = Desk.objects.create(agenda=agenda, label='Desk A')
today = datetime.date.today()
@ -2012,7 +2012,7 @@ def test_agenda_week_view(app, admin_user, manager_user, api_user, get_proper_ht
assert resp.text.count('<div class="booking" style="left:1.0%;height:33.0%;') == 2 # booking cells
assert resp.pyquery.find('div.booking a').not_('.cancel')[0].text.strip() == 'booked'
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "foo book - bar's"
assert get_proper_html_str('foo book - bar&#39;s') in resp
assert 'foo book - bar&#x27;s' in resp
assert len(resp.pyquery.find('span.desk')) == 0
agenda.booking_user_block_template = '<b>{{ booking.user_name }}</b> Foo Bar'
@ -2020,7 +2020,7 @@ def test_agenda_week_view(app, admin_user, manager_user, api_user, get_proper_ht
resp = app.get('/manage/agendas/%s/week/%s/%s/%s/' % (agenda.id, date.year, date.month, date.day))
assert resp.pyquery.find('div.booking a').not_('.cancel')[0].text.strip() == '<b></b> Foo Bar'
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "<b>bar's</b> Foo Bar"
assert get_proper_html_str('&lt;b&gt;bar&#39;s&lt;/b&gt; Foo Bar') in resp
assert '&lt;b&gt;bar&#x27;s&lt;/b&gt; Foo Bar' in resp
desk = Desk.objects.create(agenda=agenda, label='Desk B')
resp = app.get('/manage/agendas/%s/week/%s/%s/%s/' % (agenda.id, date.year, date.month, date.day))
@ -2466,7 +2466,7 @@ def test_virtual_agenda_add(app, admin_user):
assert agenda.maximal_booking_delay is None
def test_virtual_agenda_day_view(app, admin_user, manager_user, get_proper_html_str):
def test_virtual_agenda_day_view(app, admin_user, manager_user):
agenda = Agenda.objects.create(label='Virtual', kind='virtual')
real_agenda_1 = Agenda.objects.create(label='Real 1', kind='meetings')
real_agenda_2 = Agenda.objects.create(label='Real 2', kind='meetings')
@ -2527,7 +2527,7 @@ def test_virtual_agenda_day_view(app, admin_user, manager_user, get_proper_html_
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "foo - bar's"
assert resp.pyquery.find('div.booking a').not_('.cancel')[2].text.strip() == 'booked'
assert resp.pyquery.find('div.booking a').not_('.cancel')[3].text.strip() == "foo - bar's"
assert get_proper_html_str('foo - bar&#39;s') in resp
assert 'foo - bar&#x27;s' in resp
assert 'hourspan-2' in resp.text # table CSS class
assert 'height: 50%; top: 0%;' in resp.text # booking cells
@ -2540,7 +2540,7 @@ def test_virtual_agenda_day_view(app, admin_user, manager_user, get_proper_html_
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "<b>bar's</b> Bar Foo"
assert resp.pyquery.find('div.booking a').not_('.cancel')[2].text.strip() == '<b></b> Foo Bar'
assert resp.pyquery.find('div.booking a').not_('.cancel')[3].text.strip() == "<b>bar's</b> Bar Foo"
assert get_proper_html_str('&lt;b&gt;bar&#39;s&lt;/b&gt; Bar Foo') in resp
assert '&lt;b&gt;bar&#x27;s&lt;/b&gt; Bar Foo' in resp
# create a shorter meeting type, this will change the table CSS class
# (and visually this will give more room for events)
@ -2617,7 +2617,7 @@ def test_virtual_agenda_day_view(app, admin_user, manager_user, get_proper_html_
assert 'exceptions-hours' not in resp.text
def test_virtual_agenda_week_view(app, admin_user, get_proper_html_str):
def test_virtual_agenda_week_view(app, admin_user):
agenda = Agenda.objects.create(label='Virtual', kind='virtual')
real_agenda_1 = Agenda.objects.create(label='Real 1', kind='meetings')
real_agenda_2 = Agenda.objects.create(label='Real 2', kind='meetings')
@ -2683,7 +2683,7 @@ def test_virtual_agenda_week_view(app, admin_user, get_proper_html_str):
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "foo - bar's"
assert resp.pyquery.find('div.booking a').not_('.cancel')[2].text.strip() == 'booked'
assert resp.pyquery.find('div.booking a').not_('.cancel')[3].text.strip() == "foo - bar's"
assert get_proper_html_str('foo - bar&#39;s') in resp
assert 'foo - bar&#x27;s' in resp
real_agenda_1.booking_user_block_template = '<b>{{ booking.user_name }}</b> Foo Bar'
real_agenda_1.save()
@ -2694,7 +2694,7 @@ def test_virtual_agenda_week_view(app, admin_user, get_proper_html_str):
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "<b>bar's</b> Bar Foo"
assert resp.pyquery.find('div.booking a').not_('.cancel')[2].text.strip() == '<b></b> Foo Bar'
assert resp.pyquery.find('div.booking a').not_('.cancel')[3].text.strip() == "<b>bar's</b> Bar Foo"
assert get_proper_html_str('&lt;b&gt;bar&#39;s&lt;/b&gt; Bar Foo') in resp
assert '&lt;b&gt;bar&#x27;s&lt;/b&gt; Bar Foo' in resp
# cancel a booking
booking = Booking.objects.first()
@ -2740,7 +2740,7 @@ def test_virtual_agenda_week_view(app, admin_user, get_proper_html_str):
}
def test_virtual_agenda_month_view(app, admin_user, get_proper_html_str):
def test_virtual_agenda_month_view(app, admin_user):
agenda = Agenda.objects.create(label='Virtual', kind='virtual')
real_agenda_1 = Agenda.objects.create(label='Real 1', kind='meetings')
real_agenda_2 = Agenda.objects.create(label='Real 2', kind='meetings')
@ -2811,7 +2811,7 @@ def test_virtual_agenda_month_view(app, admin_user, get_proper_html_str):
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "foo - bar's"
assert resp.pyquery.find('div.booking a').not_('.cancel')[2].text.strip() == 'booked'
assert resp.pyquery.find('div.booking a').not_('.cancel')[3].text.strip() == "foo - bar's"
assert get_proper_html_str('foo - bar&#39;s') in resp
assert 'foo - bar&#x27;s' in resp
real_agenda_1.booking_user_block_template = '<b>{{ booking.user_name }}</b> Foo Bar'
real_agenda_1.save()
@ -2822,7 +2822,7 @@ def test_virtual_agenda_month_view(app, admin_user, get_proper_html_str):
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "<b>bar's</b> Bar Foo"
assert resp.pyquery.find('div.booking a').not_('.cancel')[2].text.strip() == '<b></b> Foo Bar'
assert resp.pyquery.find('div.booking a').not_('.cancel')[3].text.strip() == "<b>bar's</b> Bar Foo"
assert get_proper_html_str('&lt;b&gt;bar&#39;s&lt;/b&gt; Bar Foo') in resp
assert '&lt;b&gt;bar&#x27;s&lt;/b&gt; Bar Foo' in resp
# cancel a booking
booking = Booking.objects.first()
@ -3139,7 +3139,7 @@ def test_cant_modify_meetingtype_used_by_virtual_agenda(app, admin_user):
assert mt.label == 'MTT'
def test_cant_add_meetingtype_if_virtual_agenda(app, admin_user, get_proper_html_str):
def test_cant_add_meetingtype_if_virtual_agenda(app, admin_user):
agenda = Agenda.objects.create(label='My Virtual agenda', kind='virtual')
meeting_agenda_1 = Agenda.objects.create(label='Meeting agenda 1', kind='meetings')
MeetingType.objects.create(agenda=meeting_agenda_1, label='MT', slug='mt', duration=10)
@ -3163,10 +3163,7 @@ def test_cant_add_meetingtype_if_virtual_agenda(app, admin_user, get_proper_html
resp.form['duration'].value = '12'
resp.form['label'].value = 'Oho'
resp = resp.form.submit()
assert (
get_proper_html_str('Can&#39;t add a meetingtype to an agenda that is included in a virtual agenda.')
in resp.text
)
assert 'Can&#x27;t add a meetingtype to an agenda that is included in a virtual agenda.' in resp.text
assert MeetingType.objects.filter(agenda=meeting_agenda_1).count() == 1

View File

@ -1166,7 +1166,7 @@ def test_import_events_wrong_kind(app, admin_user):
@pytest.mark.freeze_time('2022-05-24')
def test_event_detail(app, admin_user, get_proper_html_str):
def test_event_detail(app, admin_user):
agenda = Agenda.objects.create(label='Events', kind='events')
event = Event.objects.create(
label='xyz',
@ -1181,7 +1181,7 @@ def test_event_detail(app, admin_user, get_proper_html_str):
login(app)
resp = app.get('/manage/agendas/%d/events/%d/' % (agenda.pk, event.pk))
assert 'Bookings (1/10)' in resp.text
assert get_proper_html_str('User&#39;s 1, May 24, 2022, 2 a.m.') in resp.text
assert 'User&#x27;s 1, May 24, 2022, 2 a.m.' in resp.text
assert 'Waiting List (1/2): 1 remaining place' in resp.text
assert 'User 2, May 24, 2022, 2 a.m.' in resp.text
@ -1189,7 +1189,7 @@ def test_event_detail(app, admin_user, get_proper_html_str):
agenda.save()
resp = app.get('/manage/agendas/%d/events/%d/' % (agenda.pk, event.pk))
assert 'Bookings (1/10)' in resp.text
assert get_proper_html_str('&lt;b&gt;User&#39;s 1&lt;/b&gt; Foo Bar, May 24, 2022, 2 a.m.') in resp.text
assert '&lt;b&gt;User&#x27;s 1&lt;/b&gt; Foo Bar, May 24, 2022, 2 a.m.' in resp.text
assert 'Waiting List (1/2): 1 remaining place' in resp.text
assert '&lt;b&gt;User 2&lt;/b&gt; Foo Bar, May 24, 2022, 2 a.m.' in resp.text
@ -1447,7 +1447,7 @@ def test_booking_cancellation_events_agenda(app, admin_user):
assert secondary.cancellation_datetime
def test_event_check(app, admin_user, get_proper_html_str):
def test_event_check(app, admin_user):
agenda = Agenda.objects.create(label='Events', kind='events')
Desk.objects.create(agenda=agenda, slug='_exceptions_holder')
agenda2 = Agenda.objects.create(label='Events', kind='events')
@ -1521,7 +1521,7 @@ def test_event_check(app, admin_user, get_proper_html_str):
resp = resp.click('Check')
assert (
resp.text.index('Bookings (6/10)')
< resp.text.index(get_proper_html_str("User&#39;s 01"))
< resp.text.index("User&#x27;s 01")
< resp.text.index('User 05')
< resp.text.index('User 17')
< resp.text.index('User 35')
@ -1583,7 +1583,7 @@ def test_event_check(app, admin_user, get_proper_html_str):
resp = app.get('/manage/agendas/%s/events/%s/check' % (agenda.pk, event.pk))
assert (
resp.text.index('Bookings (6/10)')
< resp.text.index(get_proper_html_str("User&#39;s 01"))
< resp.text.index("User&#x27;s 01")
< resp.text.index('User 05')
< resp.text.index('User 12 Cancelled')
< resp.text.index('Subscription 14')
@ -1604,7 +1604,7 @@ def test_event_check(app, admin_user, get_proper_html_str):
agenda.booking_user_block_template = '<b>{{ booking.user_name }}</b> Foo Bar'
agenda.save()
resp = app.get('/manage/agendas/%s/events/%s/check' % (agenda.pk, event.pk))
assert get_proper_html_str('&lt;b&gt;User&#39;s 01&lt;/b&gt; Foo Bar') in resp
assert '&lt;b&gt;User&#x27;s 01&lt;/b&gt; Foo Bar' in resp
assert '&lt;b&gt;Subscription 14&lt;/b&gt; Foo Bar' in resp
assert '&lt;b&gt;User Waiting&lt;/b&gt; Foo Bar' in resp

View File

@ -580,7 +580,7 @@ def test_exception_list(app, admin_user):
assert '/manage/time-period-exceptions/%d/edit' % future_exception.pk not in resp.text
def test_agenda_import_time_period_exception_from_ics(app, admin_user, get_proper_html_str):
def test_agenda_import_time_period_exception_from_ics(app, admin_user):
agenda = Agenda.objects.create(label='Example', kind='meetings')
desk = Desk.objects.create(agenda=agenda, label='Test Desk')
desk.duplicate()
@ -606,7 +606,7 @@ END:VEVENT
END:VCALENDAR"""
resp.form['ics_file'] = Upload('exceptions.ics', ics_with_no_start_date, 'text/calendar')
resp = resp.form.submit(status=200)
assert get_proper_html_str('Event &quot;New Year&#39;s Eve&quot; has no start date.') in resp.text
assert 'Event &quot;New Year&#x27;s Eve&quot; has no start date.' in resp.text
assert TimePeriodExceptionSource.objects.filter(desk=desk).count() == 0
ics_with_no_events = b"""BEGIN:VCALENDAR
VERSION:2.0
@ -614,7 +614,7 @@ PRODID:-//foo.bar//EN
END:VCALENDAR"""
resp.form['ics_file'] = Upload('exceptions.ics', ics_with_no_events, 'text/calendar')
resp = resp.form.submit(status=200)
assert get_proper_html_str("The file doesn&#39;t contain any events.") in resp.text
assert "The file doesn&#x27;t contain any events." in resp.text
assert TimePeriodExceptionSource.objects.filter(desk=desk).count() == 0
ics_with_exceptions = b"""BEGIN:VCALENDAR

View File

@ -80,7 +80,7 @@ def test_resource_redirect(app, admin_user):
assert resp.location.endswith('/manage/resource/%s/' % resource.pk)
def test_resource_day_view(app, admin_user, get_proper_html_str):
def test_resource_day_view(app, admin_user):
today = datetime.date.today()
resource = Resource.objects.create(label='Foo bar')
agenda = Agenda.objects.create(label='Agenda', kind='meetings')
@ -129,7 +129,7 @@ def test_resource_day_view(app, admin_user, get_proper_html_str):
assert resp.text.count('div class="booking') == 2
assert resp.pyquery.find('div.booking a').not_('.cancel')[0].text.strip() == 'booked'
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "foo - bar's"
assert get_proper_html_str('foo - bar&#39;s') in resp
assert 'foo - bar&#x27;s' in resp
assert 'hourspan-2' in resp.text # table CSS class
assert 'height: 50%; top: 0%;' in resp.text # booking cells
assert 'height: 50%; top: 50%;' in resp.text # booking cells
@ -139,7 +139,7 @@ def test_resource_day_view(app, admin_user, get_proper_html_str):
resp = app.get('/manage/resource/%s/day/%d/%d/%d/' % (resource.pk, today.year, today.month, today.day))
assert resp.pyquery.find('div.booking a').not_('.cancel')[0].text.strip() == '<b></b> Foo Bar'
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "<b>bar's</b> Foo Bar"
assert get_proper_html_str('&lt;b&gt;bar&#39;s&lt;/b&gt; Foo Bar') in resp
assert '&lt;b&gt;bar&#x27;s&lt;/b&gt; Foo Bar' in resp
# create a shorter meeting type, this will change the table CSS class
# (and visually this will give more room for events)
@ -239,7 +239,7 @@ def test_day_view_resource_as_manager(app, manager_user):
@freezegun.freeze_time('2020-06-15')
def test_resource_week_view(app, admin_user, get_proper_html_str):
def test_resource_week_view(app, admin_user):
resource = Resource.objects.create(label='Foo bar')
agenda = Agenda.objects.create(label='Agenda', kind='meetings')
agenda.resources.add(resource)
@ -280,14 +280,14 @@ def test_resource_week_view(app, admin_user, get_proper_html_str):
assert resp.text.count('<div class="booking" style="height:33.0%;') == 2 # booking cells
assert resp.pyquery.find('div.booking a').not_('.cancel')[0].text.strip() == 'booked'
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "foo - bar's"
assert get_proper_html_str('foo - bar&#39;s') in resp
assert 'foo - bar&#x27;s' in resp
agenda.booking_user_block_template = '<b>{{ booking.user_name }}</b> Foo Bar'
agenda.save()
resp = app.get('/manage/resource/%s/week/%s/%s/%s/' % (resource.pk, today.year, today.month, today.day))
assert resp.pyquery.find('div.booking a').not_('.cancel')[0].text.strip() == '<b></b> Foo Bar'
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "<b>bar's</b> Foo Bar"
assert get_proper_html_str('&lt;b&gt;bar&#39;s&lt;/b&gt; Foo Bar') in resp
assert '&lt;b&gt;bar&#x27;s&lt;/b&gt; Foo Bar' in resp
# cancel booking
booking = Booking.objects.first()
@ -344,7 +344,7 @@ def test_resource_week_view_weekend(app, admin_user):
assert 'Saturday' in resp.text
def test_resource_week_view_opening_not_even_an_hour(app, admin_user, get_proper_html_str):
def test_resource_week_view_opening_not_even_an_hour(app, admin_user):
resource = Resource.objects.create(label='Foo bar')
agenda = Agenda.objects.create(label='Agenda', kind='meetings')
agenda.resources.add(resource)
@ -574,7 +574,7 @@ def test_week_view_resource_as_manager(app, manager_user):
@freezegun.freeze_time('2020-06-15')
def test_resource_month_view(app, admin_user, get_proper_html_str):
def test_resource_month_view(app, admin_user):
resource = Resource.objects.create(label='Foo bar')
agenda = Agenda.objects.create(label='Agenda', kind='meetings')
agenda.resources.add(resource)
@ -620,14 +620,14 @@ def test_resource_month_view(app, admin_user, get_proper_html_str):
assert resp.text.count('<div class="booking" style="height:33.0%;') == 2 # booking cells
assert resp.pyquery.find('div.booking a').not_('.cancel')[0].text.strip() == 'booked'
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "foo - bar's"
assert get_proper_html_str('foo - bar&#39;s') in resp
assert 'foo - bar&#x27;s' in resp
agenda.booking_user_block_template = '<b>{{ booking.user_name }}</b> Foo Bar'
agenda.save()
resp = app.get('/manage/resource/%s/month/%s/%s/%s/' % (resource.pk, today.year, today.month, today.day))
assert resp.pyquery.find('div.booking a').not_('.cancel')[0].text.strip() == '<b></b> Foo Bar'
assert resp.pyquery.find('div.booking a').not_('.cancel')[1].text.strip() == "<b>bar's</b> Foo Bar"
assert get_proper_html_str('&lt;b&gt;bar&#39;s&lt;/b&gt; Foo Bar') in resp
assert '&lt;b&gt;bar&#x27;s&lt;/b&gt; Foo Bar' in resp
# cancel booking
booking = Booking.objects.first()