Source
'expected_error' => 'Invalid parameter "/1/lang": value must be one of "default", "en_GB", "en_US", "bg_BG", "ca_ES", "zh_CN", "zh_TW", "cs_CZ", "nl_NL", "fi_FI", "fr_FR", "ka_GE", "de_DE", "el_GR", "he_IL", "hu_HU", "id_ID", "it_IT", "ko_KR", "ja_JP", "lv_LV", "lt_LT", "nb_NO", "fa_IR", "pl_PL", "pt_BR", "pt_PT", "ro_RO", "ru_RU", "sk_SK", "es_ES", "sv_SE", "tr_TR", "uk_UA", "vi_VN".'
<?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 users
*/
class testUsers extends CAPITest {
public static function user_create() {
return [
// Check user password.
[
'user' => [
'username' => 'API user create without password',
'roleid' => 1,
'usrgrps' => [
['usrgrpid' => 7]
]
],
'Incorrect value for field "passwd": cannot be empty.'
],
// Check user username.
[
'user' => [
'passwd' => 'zabbix',
'roleid' => 1,
'usrgrps' => [
['usrgrpid' => 7]
]
],
'expected_error' => 'Invalid parameter "/1": the parameter "username" is missing.'
],
[
'user' => [
'username' => '',
'roleid' => 1,
'passwd' => 'zabbix',
'usrgrps' => [
['usrgrpid' => 7]
]
],
'expected_error' => 'Invalid parameter "/1/username": cannot be empty.'
],
[
'user' => [
'username' => 'Admin',
'roleid' => 1,
'passwd' => 'zabbix',
'usrgrps' => [
['usrgrpid' => 7]
]
],
'expected_error' => 'Incorrect value for field "/1/passwd": must be at least 8 characters long.'
],
[
'user' => [
[
'username' => 'API create users with the same names',
'roleid' => 1,
'passwd' => 'zabbix',
'usrgrps' => [
['usrgrpid' => 7]
]
],
[
'username' => 'API create users with the same names',
'roleid' => 1,
'passwd' => 'zabbix',
'usrgrps' => [
['usrgrpid' => 7]
]