Opened 3 years ago

Last modified 22 months ago

#24782 assigned New feature

Add TestCase.assertFormValid

Reported by: Marc Tamlyn Owned by: Joseph Victor Zammit
Component: Testing framework Version: master
Severity: Normal Keywords: forms
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

In the case the form is actually valid, then assertFormValid(form) is no different to assertTrue(form.is_valid), however when the assertion fails it should print some helpful output about which fields have validation errors and what those errors are. Even just outputting errors.as_json would help a lot. I've implemented code along the lines of this many times.

Change History (9)

comment:1 Changed 3 years ago by Simon Charette

Triage Stage: UnreviewedAccepted

comment:2 Changed 3 years ago by Luis Del Giudice

Owner: changed from nobody to Luis Del Giudice
Status: newassigned

comment:3 Changed 3 years ago by Tim Graham

Has patch: set
Needs documentation: set
Needs tests: set

comment:4 Changed 2 years ago by Tim Graham

Easy pickings: unset
Needs documentation: unset
Needs tests: unset
Patch needs improvement: set

See comment from Marc on the pull request for methods to be added.

comment:5 Changed 2 years ago by Joseph Victor Zammit

Owner: changed from Luis Del Giudice to Joseph Victor Zammit

comment:6 Changed 2 years ago by Joseph Victor Zammit

Patch needs improvement: unset

comment:7 Changed 2 years ago by Tim Graham

Patch needs improvement: set

Left comments for improvement.

comment:8 Changed 2 years ago by Joseph Victor Zammit

Patch needs improvement: unset

comment:9 Changed 22 months ago by Tim Graham

Patch needs improvement: set

There are comments on the new pull request for improvement.

Note: See TracTickets for help on using tickets.
Back to Top