def test_get_permission(self):
        self.client.login(username="test1", password="password")
        
        # Get permission
        add_perm_url = reverse(
            "permissions_url",
            kwargs=dict(
                perm_name="can_add",
                permittee_ct_id=ContentType.objects.get_for_model(User).id,
                permittee_id = self.u1.id,
                target_ct_id=ContentType.objects.get_for_model(ContentType).id,
                target_id=ContentType.objects.get_for_model(PermissionTestClass).id,
            )
        )
        self.client.session['from_url'] = reverse("test_view_crud")
        response = self.client.post(add_perm_url)
        self.assertRedirects(response, reverse("test_view_crud"))
        
        response = self.client.post(reverse("test_view_crud"), {"val": 3})
        self.assertRedirects(response, reverse("test_view_crud"))
        
        f = PermissionTestClass.objects.all().count()
        self.assertEqual(f, 3,
            "Did not create object: expected count %s found %s." % (3, f))
Get the permission to create then create.
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/common/permissions/tests/tests.py/TestRequests.test_get_permission