I have a function as
def getEvents(eid, request):
......
Now I want to write unit test for the above function separately (without calli
If you are using django test client (from django.test.client import Client) you can access request from response object like this:
from django.test.client import Client
client = Client()
response = client.get(some_url)
request = response.wsgi_request
or if you are using django.TestCase(from django.test import TestCase, SimpleTestCase, TransactionTestCase) you can access client instance in any testcase just by typing self.client:
response = self.client.get(some_url)
request = response.wsgi_request