Opened 4 years ago

Closed 4 years ago

#22501 closed Bug (invalid)

The testing client of LiveServerTestCase has the wrong server address

Reported by: Benny Daon 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 4 years ago by Claude Paroz

Resolution: invalid
Status: newclosed

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

comment:2 Changed 4 years ago by Benny Daon

Has patch: set
Resolution: invalid
Status: closednew

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 4 years ago by Mathieu Agopian

Resolution: invalid
Status: newclosed


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

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