I have the following CBV
class Index(TemplateView):
template_name="index.html"
def custom_method(self):
# do some stuff here
print("Test")
How can I test this method in a TestCase? I've tried the following but it's not working:
def test_custom_method(self):
response = self.client.get(reverse("index"))
view_instance = Index.as_view()
view_instance(response.wsgi_request)
view_instance.custom_method()
Aucun commentaire:
Enregistrer un commentaire