Commit d259d268 authored by Seb's avatar Seb
Browse files

update tests to run with django 5

parent a2c3302e
...@@ -149,7 +149,9 @@ class TestVideoAddView(TestCase, WagtailTestUtils): ...@@ -149,7 +149,9 @@ class TestVideoAddView(TestCase, WagtailTestUtils):
self.assertTemplateUsed(response, "wagtailvideos/videos/add.html") self.assertTemplateUsed(response, "wagtailvideos/videos/add.html")
# The form should have an error # The form should have an error
self.assertFormError(response, "form", "file", "This field is required.") self.assertFormError(
response.context["form"], "file", "This field is required."
)
@override_settings(WAGTAILVIDEOS_MAX_UPLOAD_SIZE=1) @override_settings(WAGTAILVIDEOS_MAX_UPLOAD_SIZE=1)
def test_add_too_large_file(self): def test_add_too_large_file(self):
...@@ -168,8 +170,7 @@ class TestVideoAddView(TestCase, WagtailTestUtils): ...@@ -168,8 +170,7 @@ class TestVideoAddView(TestCase, WagtailTestUtils):
# The form should have an error # The form should have an error
self.assertFormError( self.assertFormError(
response, response.context["form"],
"form",
"file", "file",
"This file is too big ({file_size}). Maximum filesize {max_file_size}.".format( "This file is too big ({file_size}). Maximum filesize {max_file_size}.".format(
file_size=filesizeformat(video_file.size), file_size=filesizeformat(video_file.size),
...@@ -446,7 +447,9 @@ class TestVideoChooserUploadView(TestCase, WagtailTestUtils): ...@@ -446,7 +447,9 @@ class TestVideoChooserUploadView(TestCase, WagtailTestUtils):
) )
# The form should have an error # The form should have an error
self.assertFormError(response, "form", "file", "This field is required.") self.assertFormError(
response.context["form"], "file", "This field is required."
)
class TestVideoChooserUploadViewWithLimitedPermissions(TestCase, WagtailTestUtils): class TestVideoChooserUploadViewWithLimitedPermissions(TestCase, WagtailTestUtils):
...@@ -686,7 +689,9 @@ class TestMultipleVideoUploader(TestCase, WagtailTestUtils): ...@@ -686,7 +689,9 @@ class TestMultipleVideoUploader(TestCase, WagtailTestUtils):
self.assertTemplateUsed(response, "wagtailvideos/multiple/edit_form.html") self.assertTemplateUsed(response, "wagtailvideos/multiple/edit_form.html")
# Check that a form error was raised # Check that a form error was raised
self.assertFormError(response, "form", "title", "This field is required.") self.assertFormError(
response.context["form"], "title", "This field is required."
)
# Check JSON # Check JSON
response_json = json.loads(response.content.decode()) response_json = json.loads(response.content.decode())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment