Opened 8 years ago

Closed 8 years ago

#7743 closed (wontfix)

Django uses "testserver" instead of "example.com" in assertRedirects tests

Reported by: John Shaffer Owned by: nobody
Component: Testing framework Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The default Site domain is "example.com". Redirects are different; I'm not sure why, but assertRedirects assumes a domain of "testserver". The domains should be made identical to avoid confusion. Note: this is only an issue when writing tests.

Change History (4)

comment:1 Changed 8 years ago by Simon Greenhill

Component: UncategorizedUnit test system
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: invalid
Status: newclosed
Summary: Django uses two different domains as defaultsDjango uses "testserver" instead of "example.com" in assertRedirects tests

I believe it's because django.test.testcases.TestCase.assertRedirects treats testserver differently?

comment:2 Changed 8 years ago by Russell Keith-Magee

Resolution: invalidfixed

(In [8535]) Fixed #7743: Reverted [8483], which was itself a reversion of [8481], after confirmation from Malcolm. Corrected a long standing mistake in the timesince/timeuntil filters when using a parameter for 'now'. Thanks to Andrew Shearer <ashearerw@…> for the report.

comment:3 Changed 8 years ago by Russell Keith-Magee

Resolution: fixed
Status: closedreopened

Oops - excuse the fat fingers. That last commit message should have referenced #7443.

comment:4 Changed 8 years ago by Malcolm Tredinnick

Resolution: wontfix
Status: reopenedclosed

Was marked as "invalid" a while back, so I assume the reopening was just the normal "oops, I auto-closed the wrong ticket". This is really "wontfix", though, since (a) the test framework does treat testserver specially and (b) introducing any accidental confusion with the use of example.com in the user's code is worth avioding. It's very clear when you see "testserver" that it's something generated by the test framework. Finally, (c) the default value of the sites setting is pretty irrelevant here, since if you are using the sites framework, you will have changed the value anyway.

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