About Dummy Files in Unit Tests
You can create uploaded files in unit tests using the SimpleUploadedFile
class:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
Don't forget to delete the files in tearDown(self)
or tearDownClass(cls)
method:
1 2 |
|
Tips and Tricks Programming Testing Django 4.2 Django 3.2 Django 2.2 Django 1.11 Django 1.8
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.