You've got your 2FA in place, but you need to check it. In this video, learn how to write a unit test demonstrating how to test actions that require 2FA.
- [Narrator] We're going to unit test two-factor auth. … So we need to create an auth code for the user … in this test case. … So we use two factor auth code … object star create, pass in the user … that we're using for tests, … and the code will be a simple one. … And now in our first test, we're going to be … (keyboard clunking) … making a post request to this validate API URL. … This is just a convenient view that we're using simply … to validate the auth code. … And we pass in the auth code as a data parameter, … and we pass in the authenticated user headers … as part of the request. … The request response should be an okay, … and the two factor auth code should have been deleted. … (keyboard clunking) … We also need to check that an activity log was created, … (keyboard clunking) … and that the action of this log entry … was user entered correct two factor auth code. … In the second test here, we have an invalid auth code, … so it's something similar to the first test, … (keyboard clunking) …
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.