tests: adapt to pass with both 2.2 and 3.2

This commit is contained in:
Frédéric Péters 2022-08-02 17:00:40 +02:00
parent 3f20128208
commit f4bd375ba7
3 changed files with 3 additions and 6 deletions

View File

@ -79,10 +79,7 @@ def test_media():
app_label = 'data'
cells = [TextCelleWithMedia() for i in range(3)]
assert (
force_text(sum((cell.media for cell in cells), Media()))
== '<script src="/static/coincoin.js"></script>'
)
assert '/static/coincoin.js' in force_text(sum((cell.media for cell in cells), Media()))
def test_additional_label():

View File

@ -602,7 +602,7 @@ def test_404(app):
with override_settings(DEBUG=True):
# check error page provides an hint when debugging
resp = app.get('/foobar/', status=404)
assert "can&#x27;t find the requested page" in resp.text
assert "find the requested page" in resp.text
# check native django handler is used if all pages are private
page.public = False

View File

@ -1432,7 +1432,7 @@ def test_index_site_num_queries(settings, app):
assert IndexedCell.objects.count() == 50
with CaptureQueriesContext(connection) as ctx:
index_site()
assert len(ctx.captured_queries) == 175
assert len(ctx.captured_queries) in (175, 225) # (3.2, 2.2)
SearchCell.objects.create(
page=page, placeholder='content', order=0, _search_services={'data': ['search1']}