5
It is always a good idea to test status_code
even with views rendering templates.
Django gives you ability to pass status code of your wish while rendering templates.
Both render()
and render_to_response
take status
as keyword argument so that you can render the page with a status code you think is appropriate for the view.
Thus, you can render templates with any response status code not just 200
. This gives you a reason to test status code while using assertTemplateUsed
as a context manager.
2
Itβs not redundant if you app might send different responses status using the same template. In general cases, using the assertTemplateUsed
itβs just fine.
- [Django]-Automate deployments in ec2
- [Django]-Django always capitalizes a model's verbose name in admin index page
Source:stackexchange.com