From the course: Securing Django Applications
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Unit test for per-object permissions in Django - Django Tutorial
From the course: Securing Django Applications
Unit test for per-object permissions in Django
- [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.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Setting up per-object permissions in Django59s
-
(Locked)
Enabling per-object permissions in Django3m 47s
-
(Locked)
Unit test for per-object permissions in Django2m 48s
-
(Locked)
Creating a group permissions model4m 27s
-
(Locked)
Unit test for access control and group permissions3m 38s
-
(Locked)
Adding activity logs for auditing3m 4s
-
(Locked)
Deleting objects in an audit/compliance-compatible way3m 46s
-
-
-
-
-
-