jl6
jl6

Reputation: 6394

How do I test whether a Django response was generated by a particular view?

In writing unit tests for Django, how would I test whether a particular view was used in rendering a URL? I was hoping there would exist TestCase.assertViewUsed, but I can't see it.

Thanks.

Upvotes: 0

Views: 62

Answers (1)

gruszczy
gruszczy

Reputation: 42188

You can try to use django.core.urlresolvers.reverse to create an url from view. This way you will see, whether view is mapped properly to an address.

Upvotes: 2

Related Questions