'#17903 -- Inactive users shouldn\'t have permissions in
ModelBackend.get_(all|user|group)_permissions().'

def test_inactive_has_no_permissions(self):

    backend = ModelBackend()
    user = self.UserModel._default_manager.get(pk=self.user.pk)
    content_type = ContentType.objects.get_for_model(Group)
    user_perm = Permission.objects.create(name='test', content_type=content_type, codename='test_user')
    group_perm = Permission.objects.create(name='test2', content_type=content_type, codename='test_group')
    user.user_permissions.add(user_perm)
    group = Group.objects.create(name='test_group')
    user.groups.add(group)
    group.permissions.add(group_perm)
    self.assertEqual(backend.get_all_permissions(user), {'auth.test_user', 'auth.test_group'})
    self.assertEqual(backend.get_user_permissions(user), {'auth.test_user', 'auth.test_group'})
    self.assertEqual(backend.get_group_permissions(user), {'auth.test_group'})
    user.is_active = False
    user.save()
    self.assertEqual(backend.get_all_permissions(user), set())
    self.assertEqual(backend.get_user_permissions(user), set())
    self.assertEqual(backend.get_group_permissions(user), set())
