Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
Wagtail Videos
Commits
d259d268
Commit
d259d268
authored
Dec 30, 2023
by
Seb
Browse files
update tests to run with django 5
parent
a2c3302e
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_admin_views.py
View file @
d259d268
...
@@ -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
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment