Source
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__).'/../common/testFormApiTokens.php';
require_once dirname(__FILE__).'/../../include/helpers/CDataHelper.php';
/**
* @backup token
*
* @onBefore prepareTokenData
* @dataSource LoginUsers
*/
class testFormApiTokensAdministrationGeneral extends testFormApiTokens {
public $url = 'zabbix.php?action=token.list';
/**
* Function creates the given API tokens in the test branch.
*/
public static function prepareTokenData() {
$response = CDataHelper::call('token.create', [
[
'name' => 'Admin reference token',
'userid' => 1,
'description' => 'admin token to be used in update scenarios',
'status' => '0',
'expires_at' => '1798754399'
],
[
'name' => 'Token to be deleted',
'userid' => 1,
'description' => 'Token to be deleted in the delete scenario',
'status' => '0',
'expires_at' => '1798754399'
],
[
'name' => 'user-zabbix token',
'userid' => 50,
'description' => 'Token that is generated for user',
'status' => '0',
'expires_at' => '1798754399'
],
[
'name' => 'Token for cancel or simple update',
'userid' => 1,
'description' => 'Token for testing cancelling',
'status' => '0',
'expires_at' => '1798754399'
]
]);