Unit test to make sure correct template is returned from a specific URL?

53 views
Skip to first unread message

Simon Connah

unread,
Sep 24, 2023, 10:38:18 AM9/24/23
to django...@googlegroups.com
I can write a unit test which checks say the title on a page and compares it to a string but that is really prone to breakage. What I want to do instead is to check that the template that is returned by the URL is the same one that is expected in the unit test. Is there an easy way to do this?
signature.asc

Muhammad Juwaini Abdul Rahman

unread,
Sep 25, 2023, 9:08:43 AM9/25/23
to django...@googlegroups.com

On Sun, 24 Sept 2023 at 22:37, 'Simon Connah' via Django users <django...@googlegroups.com> wrote:
I can write a unit test which checks say the title on a page and compares it to a string but that is really prone to breakage. What I want to do instead is to check that the template that is returned by the URL is the same one that is expected in the unit test. Is there an easy way to do this?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/MnCVU2YvJzLiFdMPPAVBwMY7SMosqS5wvqopbySnD05i7BTc375v_Bo5GB4VlUQSd5K2OwsiblAbxsfsz7in96L4_Ou4RTRm0jwVN3aMp54%3D%40protonmail.com.

Simon Connah

unread,
Sep 25, 2023, 9:43:31 AM9/25/23
to django...@googlegroups.com
Thank you very much!

------- Original Message -------
signature.asc

Abhishek ozha

unread,
Sep 25, 2023, 9:51:52 AM9/25/23
to Django users
got some issues in unit test in django,could anypone have a look
Reply all
Reply to author
Forward
0 new messages