0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00

Fix test to handle different script tag format in Django 3.1

This commit is contained in:
Matt Westcott 2020-07-03 17:15:17 +01:00 committed by Matt Westcott
parent 98682412dc
commit 4879583fac

View File

@ -2,6 +2,7 @@
import json
from django import VERSION as DJANGO_VERSION
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, Permission
from django.core import mail
@ -32,10 +33,19 @@ class TestHome(TestCase, WagtailTestUtils):
response = self.client.get(reverse('wagtailadmin_home'))
self.assertEqual(response.status_code, 200)
# check that media attached to menu items is correctly pulled in
self.assertContains(
response,
'<script type="text/javascript" src="/static/testapp/js/kittens.js"></script>'
)
if DJANGO_VERSION >= (3, 1):
self.assertContains(
response,
'<script src="/static/testapp/js/kittens.js"></script>',
html=True
)
else:
self.assertContains(
response,
'<script type="text/javascript" src="/static/testapp/js/kittens.js"></script>',
html=True
)
# check that custom menu items (including classname / attrs parameters) are pulled in
self.assertContains(
response,