Your task queue is in place but you need to check it. In this video, learn how to write a unit test to ensure that background queuing is working correctly.
- [Narrator] Our first test case, … we'll test the celery task that was created. … In the setup method we have to first clear the cache, … and then in our first test, we're going to be asserting … that the cache does not have any key set, … specifically the key for this user ID. … And then we're going to call our background task, … with that user ID and the text. … And then we're going to be checking … that the comment was created. … We make sure the text is equal to example, … and we also make sure … that the cache was set for this cache key … and that the cache value was set to the comment ID. … For our next task, … we're going to be marking out … the retry function of create comment, … and we're going to be making sure … that retrying and queuing up this background task … for later can be done. … We have the create comment retry lock here, … and our user ID will be the first user's ID. … And then we're going to call create comment with that user ID, … just like in the first test case. …
Skill Level Advanced
Building a Paid Membership Site with Djangowith Nick Walter1h 15m Intermediate
OWASP Top 10: #7 XSS and #8 Insecure Deserializationwith Caroline Wong26m 31s Intermediate
Building RESTful Web APIs with Djangowith Rudolf Olah1h 9m Intermediate
1. Permissions, Access Controls, Activity Logs
2. Throttling a Flood of Requests
3. Protecting Data and Data Privacy
4. 2FA: Two-Factor Authentication
5. CSRF: Cross-Site Request Forgery Protection
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.