'User can delete groups he created if can_change_permissions
is set to True.'

def test_user_can_delete_subordinate_group(self):

    staff_user = self.get_staff_user_with_no_permissions()
    group = self._get_group(created_by=staff_user)
    endpoint = self.get_admin_url(PageUserGroup, 'delete', group.pk)
    redirect_to = admin_reverse('index')
    data = {'post': 'yes'}
    self.add_permission(staff_user, 'delete_group')
    self.add_permission(staff_user, 'delete_pageusergroup')
    self.add_page_permission(staff_user, self._permissions_page, can_change_permissions=True)
    with self.login_user_context(staff_user):
        response = self.client.post(endpoint, data)
        self.assertRedirects(response, redirect_to)
        self.assertFalse(self._group_exists())
