I am using a class attribute to save the View that I want to test in a Django application, like this:
# TESTS.PY
class OrderTests(TestCase, ShopTest):
_VIEW = views.order
def test_gateway_answer(self):
url = 'whatever url'
request = self.request_factory(url, 'GET')
self._VIEW(request, **{'sku': order.sku})
# VIEWS.PY
def order(request, sku)
...
But during execution, as I call an attribute of my object OrderTests
Python sends self
as argument, which does not match the signature of the order
function and causes all kinds of problems.
Is there any way to make Python not send self
in this case?