Source
'expected_error' => 'User group "API user group in configuration" is used in configuration for database down messages.'
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once dirname(__FILE__).'/../include/CAPITest.php';
/**
* @backup usrgrp
*/
class testUserGroup extends CAPITest {
public static function usergroup_create() {
return [
[
'group' => [
'name' => 'non existent parameter',
'usrgrpid' => '7'
],
'expected_error' => 'Invalid parameter "/1": unexpected parameter "usrgrpid".'
],
// Check user group name.
[
'group' => [
'gui_access' => GROUP_GUI_ACCESS_SYSTEM
],
'expected_error' => 'Invalid parameter "/1": the parameter "name" is missing.'
],
[
'group' => [
'name' => ''
],
'expected_error' => 'Invalid parameter "/1/name": cannot be empty.'
],
[
'group' => [
'name' => 'Zabbix administrators'
],
'expected_error' => 'User group "Zabbix administrators" already exists.'
],
[
'group' => [
[
'name' => 'One user group with existing name'
],
[
'name' => 'Zabbix administrators'
]
],
'expected_error' => 'User group "Zabbix administrators" already exists.'
],
[
'group' => [
[
'name' => 'User group with two identical name'
],
[
'name' => 'User group with two identical name'
]
],
'expected_error' => 'Invalid parameter "/2": value (name)=(User group with two identical name) already exists.'
],
// Check Super Admin user in group.
[
'group' => [
'name' => 'Admin in group with disabled GUI access',
'gui_access' => GROUP_GUI_ACCESS_DISABLED,
'users' => ['userid' => 1]
],
'expected_error' => 'User cannot add himself to a disabled group or a group with disabled GUI access.'
],
[
'group' => [
'name' => 'Admin in disabled group',
'users_status' => 1,