Since Class based Generic Views in Django involve some work by the framework I find very hard to work with them in a TDD style. Now I use the TestClient to access the view from
Generally, that would include creating a request via the RequestFactory and instantiating the view class with keyword arguments. Afterwards, you can call any of the view methods and evaluate the result, passing any required arguments.
I'd recommend that you review the base View class, specifically the __init__, as_view and dispatch methods. They're crucial to understanding how the framework interacts with view objects.
The most important bit to notice there is that view methods expect to be called during a request-response process, so they're allowed to rely upon self.request
, self.args
and self.kwargs
to be present before they're called, so make sure you've got that covered.