Unit testing is a vital part of making sure that your code works as expected. In this video, learn how to write a unit test to ensure that the per-object filtering is working correctly.
- [Instructor] Let's unit test … the per object permission testing. … We already have the setup for the test. … It shows that there's a package already existing, … and two users have been created. … In our test, we're going to try updating a booking, … made by one user and updating it from a second user. … So we're to create the booking. … (keyboard stroking) … The email address will be the email address … of the first user. … (keyboard stroking) … And then we're going to save the booking. … (keyboard stroking) … And we're going to assert … that our post save signal is working correctly, … by asserting that the first user has permission … to change the booking. … (keyboard stroking) … Then we're going to make sure that the second user, … (keyboard stroking) … does not have permission to change that booking. … (keyboard stroking) … Then we're going to be making an API call. … (keyboard stroking) … And we're going to be updating the name of that booking. … (keyboard stroking) … And we're making a patch request …
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.