diff --git a/README.md b/README.md index 2ab20d1..0df6a82 100644 --- a/README.md +++ b/README.md @@ -19,59 +19,60 @@ - [Why not?](#why-not) - [Cookie Cutter](#cookie-cutter) - [Models](#models) - - [Base model](#base-model) - - [Validation - `clean` and `full_clean`](#validation---clean-and-full_clean) - - [Validation - constraints](#validation---constraints) - - [Properties](#properties) - - [Methods](#methods) - - [Testing](#testing) + * [Base model](#base-model) + * [Validation - `clean` and `full_clean`](#validation---clean-and-full_clean) + * [Validation - constraints](#validation---constraints) + * [Properties](#properties) + * [Methods](#methods) + * [Testing](#testing) - [Services](#services) - - [Example - function-based service](#example---function-based-service) - - [Example - class-based service](#example---class-based-service) - - [Naming convention](#naming-convention) - - [Modules](#modules) - - [Selectors](#selectors) - - [Testing](#testing-1) + * [Example - function-based service](#example---function-based-service) + * [Example - class-based service](#example---class-based-service) + * [Naming convention](#naming-convention) + * [Modules](#modules) + * [Selectors](#selectors) + * [Testing](#testing-1) - [APIs & Serializers](#apis--serializers) - - [Naming convention](#naming-convention-1) - - [Class-based vs. Function-based](#class-based-vs-function-based) - - [List APIs](#list-apis) - - [Plain](#plain) - - [Filters + Pagination](#filters--pagination) - - [Detail API](#detail-api) - - [Create API](#create-api) - - [Update API](#update-api) - - [Fetching objects](#fetching-objects) - - [Nested serializers](#nested-serializers) - - [Advanced serialization](#advanced-serialization) + * [Naming convention](#naming-convention-1) + * [Class-based vs. Function-based](#class-based-vs-function-based) + * [List APIs](#list-apis) + + [Plain](#plain) + + [Filters + Pagination](#filters--pagination) + * [Detail API](#detail-api) + * [Create API](#create-api) + * [Update API](#update-api) + * [Fetching objects](#fetching-objects) + * [Nested serializers](#nested-serializers) + * [Advanced serialization](#advanced-serialization) - [Urls](#urls) - [Settings](#settings) - - [Prefixing environment variables with `DJANGO_`](#prefixing-environment-variables-with-django_) - - [Integrations](#integrations) - - [Reading from `.env`](#reading-from-env) + * [Prefixing environment variables with `DJANGO_`](#prefixing-environment-variables-with-django_) + * [Integrations](#integrations) + * [Reading from `.env`](#reading-from-env) - [Errors & Exception Handling](#errors--exception-handling) - - [How exception handling works (in the context of DRF)](#how-exception-handling-works-in-the-context-of-drf) - - [DRF's `ValidationError`](#drfs-validationerror) - - [Django's `ValidationError`](#djangos-validationerror) - - [Describe how your API errors are going to look like.](#describe-how-your-api-errors-are-going-to-look-like) - - [Know how to change the default exception handling behavior.](#know-how-to-change-the-default-exception-handling-behavior) - - [Approach 1 - Use DRF's default exceptions, with very little modifications.](#approach-1---use-drfs-default-exceptions-with-very-little-modifications) - - [Approach 2 - HackSoft's proposed way](#approach-2---hacksofts-proposed-way) - - [More ideas](#more-ideas) + * [How exception handling works (in the context of DRF)](#how-exception-handling-works-in-the-context-of-drf) + + [DRF's `ValidationError`](#drfs-validationerror) + + [Django's `ValidationError`](#djangos-validationerror) + * [Describe how your API errors are going to look like.](#describe-how-your-api-errors-are-going-to-look-like) + * [Know how to change the default exception handling behavior.](#know-how-to-change-the-default-exception-handling-behavior) + * [Approach 1 - Use DRF's default exceptions, with very little modifications.](#approach-1---use-drfs-default-exceptions-with-very-little-modifications) + * [Approach 2 - HackSoft's proposed way](#approach-2---hacksofts-proposed-way) + * [More ideas](#more-ideas) - [Testing](#testing-2) - - [Naming conventions](#naming-conventions) - - [Factories](#factories) + * [Overview](#overview-1) + * [Naming conventions](#naming-conventions) + * [Factories](#factories) - [Celery](#celery) - - [The basics](#the-basics) - - [Error handling](#error-handling) - - [Configuration](#configuration) - - [Structure](#structure) - - [Periodic Tasks](#periodic-tasks) - - [Beyond](#beyond) + * [The basics](#the-basics) + * [Error handling](#error-handling) + * [Configuration](#configuration) + * [Structure](#structure) + * [Periodic Tasks](#periodic-tasks) + * [Beyond](#beyond) - [Cookbook](#cookbook) - - [Handling updates with a service](#handling-updates-with-a-service) + * [Handling updates with a service](#handling-updates-with-a-service) - [DX (Developer Experience)](#dx-developer-experience) - - [`mypy` / type annotations](#mypy--type-annotations) + * [`mypy` / type annotations](#mypy--type-annotations) - [Django Styleguide in the Wild](#django-styleguide-in-the-wild) - [Additional resources](#additional-resources) - [Inspiration](#inspiration) @@ -2342,6 +2343,14 @@ You can even handle all exceptions, but then, you should be sure those exception ## Testing +### Overview + +Testing is an interesting & vast topic. + +As an overview, you can listen to [Radoslav Georgiev's talk at DjangoCon Europe 2022](https://www.youtube.com/watch?v=PChaEAIsQls): + +[![Quality Assurance in Django - Testing what matters](https://img.youtube.com/vi/PChaEAIsQls/0.jpg)](https://www.youtube.com/watch?v=PChaEAIsQls) + In our Django projects, we split our tests depending on the type of code they represent. Meaning, we generally have tests for models, services, selectors & APIs / views.