title: How to unit test methods inside django's class based views?
body: <p>I need to test the methods and helper function inside a django Class Based View.</p>
  
  <p>Consider this Class Based View:</p>
  
  <pre><code>class MyClassBasedView(View):
  
      def dispatch(self, request, *args, **kwargs):
          ....
  
      def __get_render_dict():
          d = {}
          ...
          return d
  
      def my_method(self):
          render_dict =  self.__get_render_dict()
          return render_response(self.request, 'template.html', render_dict)
  </code></pre>
  
  <p>In order to write unit tests for my view, I need to call the methods inside, say <code>__get_render_dict()</code> directly. How can I achieve this?.</p>
  
  <p>I've tried </p>
  
  <pre><code>v = MyClassedBasedView() 
  v.dispatch(request,args, kwargs)
  v.__method_name()
  </code></pre>
  
  <p>but this fails with not matching parameters in post/get method, even though I was calling the method direclty without using URL.</p>