Opened 7 years ago

Closed 7 years ago

#7743 closed (wontfix)

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

Reported by: jshaffer 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 7 years ago by Simon Greenhill

  • Component changed from Uncategorized to Unit test system
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed
  • Summary changed from Django uses two different domains as defaults to Django 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 7 years ago by russellm

  • Resolution changed from invalid to fixed

(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 7 years ago by russellm

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

comment:4 Changed 7 years ago by mtredinnick

  • Resolution set to wontfix
  • Status changed from reopened to closed

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