I am testing an API with Django test client. The API uses geo blocking so in my test I need to specify an IP address to make sure it works properly. How can I do that?
I am making a request in my test like this:
from django.test.client import Client as HttpClient
.
.
.
client = HttpClient()
response = client.get(uri + query_string)
The Client.get()
method has an extra
keyword arguments parameter, which can be used to specify headers.
c.get(/my-url/, REMOTE_ADDR="127.0.0.1")