Welcome to mirror list, hosted at ThFree Co, Russian Federation.

testAuditlogProxy.php « api_json « tests « ui - github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5a7905d0a41db94ac23a8961bc7ce09d8931b249 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?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__).'/common/testAuditlogCommon.php';

/**
 * @backup hosts
 */
class testAuditlogProxy extends testAuditlogCommon {

	/**
	 * Existing Proxy ID.
	 */
	private const PROXYID = 99000;

	/**
	 * Created proxy ID.
	 */
	private static $resourceid;

	public function testAuditlogProxy_Create() {
		$create = $this->call('proxy.create', [
			[
				'host' => 'Audit proxy',
				'status' => 5,
				'description' => 'Proxy audit description',
				'tls_accept' => 2,
				'proxy_address' => 'localhost',
				'tls_psk_identity' => 'Audit',
				'tls_psk' => '11111595725ac58dd977beef14b97461a7c1045b9a1c923453302c5473193478'
			]
		]);

		self::$resourceid = $create['result']['proxyids'][0];

		$created = json_encode([
			'proxy.host' => ['add', 'Audit proxy'],
			'proxy.status' => ['add', '5'],
			'proxy.description' => ['add', 'Proxy audit description'],
			'proxy.tls_accept' => ['add', '2'],
			'proxy.proxy_address' => ['add', 'localhost'],
			'proxy.tls_psk_identity' => ['add', '******'],
			'proxy.tls_psk' => ['add', '******'],
			'proxy.proxyid' => ['add', self::$resourceid]
		]);

		$this->getAuditDetails('details', $this->add_actionid, $created, self::$resourceid);
	}

	public function testAuditlogProxy_Update() {
		$updated = json_encode([
			'proxy.host' => ['update', 'Updated Audit proxy', 'API active proxy for discovery action'],
			'proxy.description' => ['update', 'Update proxy audit description', ''],
			'proxy.tls_accept' => ['update', '2', '1'],
			'proxy.proxy_address' => ['update', 'updated_address', ''],
			'proxy.tls_psk_identity' => ['update', '******', '******'],
			'proxy.tls_psk' => ['update', '******', '******']
		]);

		$this->call('proxy.update', [
			[
				'proxyid' => self::PROXYID,
				'host' => 'Updated Audit proxy',
				'status' => 5,
				'description' => 'Update proxy audit description',
				'tls_accept' => 2,
				'proxy_address' => 'updated_address',
				'tls_psk_identity' => 'Updated_TSK',
				'tls_psk' => '11111595725ac58dd977beef14b97461a7c1045b9a1c923453302c5473193111'
			]
		]);

		$this->getAuditDetails('details', $this->update_actionid, $updated, self::PROXYID);
	}

	/**
	 * @depends testAuditlogProxy_Create
	 */
	public function testAuditlogProxy_Delete() {
		$this->call('proxy.delete', [self::$resourceid]);
		$this->getAuditDetails('resourcename', $this->delete_actionid, 'Audit proxy', self::$resourceid);
	}
}