How to create Tests for Class Based views in Django

Viewed 42

This question might be a little too simple idk. I am very new to testing. I recently made a Django project using all Class-Based views. While I am pretty familiar with Django I am not very familiar with the class-based views so decided to use them in my recent project.

I am learning Testing and implemented pytest in one of my FastAPI projects recently. I would say writing tests were easier than I expected or maybe my application was too simple.

While there are thousands of pytest courses or testing courses in general available online. I have not seen any focusing on Django class-based views.

I am asking this because in class-based views there is a lot of inheritance of prebuilt methods and Views.

Will I be able to create tests for class-based views if I go through a good pytest course or do you suggest any particular resource that is specific to the class-based views?

I am asking because I want to present this project in an interview and that company seems to care a lot about testing.

Here is the Github repo of the project I want to implement tests on: https://github.com/sumitdadwal/django-bookstore-project

Also, this is the course I am thinking to take to learn pytest: https://www.udemy.com/course/pytest-course/. I would appreciate if anyone can suggest more resources that they have gone through.

Thanks in advance!

0 Answers
Related