Opened 17 years ago

Closed 17 years ago

#6521 closed (wontfix)

add a "name" parameter to test client get() and post() methods

Reported by: Will Hardy Owned by: nobody
Component: Testing framework Version: dev
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Allow named url patterns to be entered directly into the test client's get() and post() methods for the sake of readability and to encourage use of named url paths.
For example, instead of:

        url = reverse('poll_edit', args=(24,))
        response = client.get(url)

It would become:

        response = client.get(name='poll_edit', args=(24,))

This may of course conflict with the direct passing of extra header information to get() and post()

Change History (3)

comment:1 by Will Hardy, 17 years ago

I can write the tests and a patch if people think this idea is worthwhile.

comment:2 by Chris Beaven, 17 years ago

Component: UncategorizedUnit test system
Triage Stage: UnreviewedDesign decision needed

Interesting idea

comment:3 by Russell Keith-Magee, 17 years ago

Resolution: wontfix
Status: newclosed

I'm afraid I don't see the benefit here. client.get() has a very clear and obvious API - it takes a URL. reverse() has a very clear and obvious API - it takes a name, and turns it into a URL. This change would require you to munge the API of client.get() and add a whole lot of messy error checking just so you can avoid typing 4 characters. This seems like a false economy to me.

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