Opened 2 years ago

Closed 2 years ago

#22501 closed Bug (invalid)

The testing client of LiveServerTestCase has the wrong server address

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


When executing a test using self.client the view's request has 'testserver' as the SERVER_NAME and '80' as the SERVER_PORT regardless of the actual address used by the live server.

Change History (3)

comment:1 Changed 2 years ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

The test client is not meant to query the live server. To interact with the live server, use Selenium.

comment:2 Changed 2 years ago by daonb

  • Has patch set
  • Resolution invalid deleted
  • Status changed from closed to new

Sorry for not being descriptive enough, let me try again.

My app's view is accessing the RESTfull API of my project and is using the request object to find out the local address (I know it's not the right way to do thing, and I'm only doing it because we have two projects that interact and it's still not clear where the app will be). Writing the tests we've discovered that even though we're using the LiveServerTestCase, the view gets the wrong address in the request object.

comment:3 Changed 2 years ago by magopian

  • Resolution set to invalid
  • Status changed from new to closed


this is actually a feature, to have reproducible tests wherever you run them:

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