Use assertTemplateUsed. https://docs.djangoproject.com/en/dev/topics/testing/tools/#django.test.SimpleTestCase.assertTemplateUsed
On Sun, 24 Sept 2023 at 22:37, 'Simon Connah' via Django users < [email protected]> 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/MnCVU2YvJzLiFdMPPAVBwMY7SMosqS5wvqopbySnD05i7BTc375v_Bo5GB4VlUQSd5K2OwsiblAbxsfsz7in96L4_Ou4RTRm0jwVN3aMp54%3D%40protonmail.com > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFKhtoRiz4mr69ZLu7_wCxVFXgjnvmAW3JCoYdcDrx%2Bwu94vrw%40mail.gmail.com.

