Mastering Django Unit Testing: An In-Depth Introduction and Tutorial
Legion Script Legion Script
5.14K subscribers
3,589 views
70

 Published On Jun 28, 2023

In this comprehensive tutorial on Django unit testing, we cover the basic principles of testing and demonstrate how to write effective tests for models and views. We discuss creating isolated test cases, organizing tests, and provide best practices for readability and maintainability. You'll learn how to test Django models and Django views, including generic class based views, as well as how to simulate requests, authenticate users, and assert responses for views. By the end, you'll have the knowledge to confidently write robust tests for your Django applications. Let's dive into the world of Django unit testing together!

Timestamps:
00:00 - Intro
00:55 - Basic Testing Concepts
07:08 - Testing Models
15:41 - Testing Index View
21:28 - Testing Dashboard User Logged In
25:20 - Testing Dashboard User Not Logged In
27:59 - Testing Generic CreateView with Data
35:12 - Testing Generic CreateView with No Data
36:59 - Testing Generic UpdateView with Data
42:44 - Testing Generic DeleteView
45:45 - One Possible Troubleshooting Solution

Starting Code:
https://github.com/legionscript/inven...

Ending Code:
https://github.com/legionscript/inven...

Django Testing:
https://docs.djangoproject.com/en/4.2...

Python unittest:
https://docs.python.org/3/library/uni...

Free Structured Courses on LegionScript.com:
https://www.legionscript.com/

show more

Share/Embed