def METHOD_NAME(self, *permissions):
    if permissions:
        permission_filter = reduce(operator.or_, (
            Q(content_type__app_label=app_label, codename=codename)
            for app_label, codename in (
                permission.split(".")
                for permission in permissions
            )
        ))
        self.ui_group.permissions.set(list(Permission.objects.filter(permission_filter)))
    else:
        self.ui_group.permissions.clear()
    self.client.force_login(self.ui_user)