Opened 13 years ago

Last modified 12 years ago

#4476 closed

Proposal for assertRedirectContains — at Initial Version

Reported by: Chris Moffitt <chris.moffitt@…> Owned by: Jacob
Component: Testing framework Version: master
Severity: Keywords:
Cc: kbussell@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When using assertRedirects, I find myself doing an assert redirects, then wanting to validate the text where I'm redirecting. The process seems a little clunky and an assertRedirectContains would be useful.

Current process:

self.assertRedirects(response, '/confirm/', status_code=302, target_status_code=200)
response = self.client.get('/confirm/')
self.assertContains(response, "Total = $54.50", count=1, status_code=200)

It would be nice to have something like:

self.assertRedirectContains(response, "Total = $54.50", count=1, status_code=302, target_status_code=200)

I'm assuming there's no other shortcut I'm missing.

Change History (0)

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