1
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
# Copyright (C) 2018-2021 Greenbone Networks GmbH |
3
|
|
|
# |
4
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later |
5
|
|
|
# |
6
|
|
|
# This program is free software: you can redistribute it and/or modify |
7
|
|
|
# it under the terms of the GNU General Public License as published by |
8
|
|
|
# the Free Software Foundation, either version 3 of the License, or |
9
|
|
|
# (at your option) any later version. |
10
|
|
|
# |
11
|
|
|
# This program is distributed in the hope that it will be useful, |
12
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
|
|
|
# GNU General Public License for more details. |
15
|
|
|
# |
16
|
|
|
# You should have received a copy of the GNU General Public License |
17
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
18
|
|
|
|
19
|
|
|
|
20
|
|
|
class GmpGetScanConfigNvtsTestMixin: |
21
|
|
|
def test_get_scan_config_nvts_simple(self): |
22
|
|
|
self.gmp.get_scan_config_nvts() |
23
|
|
|
|
24
|
|
|
self.connection.send.has_been_called_with('<get_nvts/>') |
25
|
|
|
|
26
|
|
|
def test_get_scan_config_nvts_with_details(self): |
27
|
|
|
self.gmp.get_scan_config_nvts(details=True) |
28
|
|
|
|
29
|
|
|
self.connection.send.has_been_called_with('<get_nvts details="1"/>') |
30
|
|
|
|
31
|
|
|
self.gmp.get_scan_config_nvts(details=False) |
32
|
|
|
|
33
|
|
|
self.connection.send.has_been_called_with('<get_nvts details="0"/>') |
34
|
|
|
|
35
|
|
|
def test_get_scan_config_nvts_with_preferences(self): |
36
|
|
|
self.gmp.get_scan_config_nvts(preferences=True) |
37
|
|
|
|
38
|
|
|
self.connection.send.has_been_called_with('<get_nvts preferences="1"/>') |
39
|
|
|
|
40
|
|
|
self.gmp.get_scan_config_nvts(preferences=False) |
41
|
|
|
|
42
|
|
|
self.connection.send.has_been_called_with('<get_nvts preferences="0"/>') |
43
|
|
|
|
44
|
|
|
def test_get_scan_config_nvts_with_preference_count(self): |
45
|
|
|
self.gmp.get_scan_config_nvts(preference_count=True) |
46
|
|
|
|
47
|
|
|
self.connection.send.has_been_called_with( |
48
|
|
|
'<get_nvts preference_count="1"/>' |
49
|
|
|
) |
50
|
|
|
|
51
|
|
|
def test_get_scan_config_nvts_with_timeout(self): |
52
|
|
|
self.gmp.get_scan_config_nvts(timeout=True) |
53
|
|
|
|
54
|
|
|
self.connection.send.has_been_called_with('<get_nvts timeout="1"/>') |
55
|
|
|
|
56
|
|
|
self.gmp.get_scan_config_nvts(timeout=False) |
57
|
|
|
|
58
|
|
|
self.connection.send.has_been_called_with('<get_nvts timeout="0"/>') |
59
|
|
|
|
60
|
|
|
def test_get_scan_config_nvts_with_config_id(self): |
61
|
|
|
self.gmp.get_scan_config_nvts(config_id='config_id') |
62
|
|
|
|
63
|
|
|
self.connection.send.has_been_called_with( |
64
|
|
|
'<get_nvts config_id="config_id"/>' |
65
|
|
|
) |
66
|
|
|
|
67
|
|
|
def test_get_scan_config_nvts_with_preferences_config_id(self): |
68
|
|
|
self.gmp.get_scan_config_nvts( |
69
|
|
|
preferences_config_id='preferences_config_id' |
70
|
|
|
) |
71
|
|
|
|
72
|
|
|
self.connection.send.has_been_called_with( |
73
|
|
|
'<get_nvts preferences_config_id="preferences_config_id"/>' |
74
|
|
|
) |
75
|
|
|
|
76
|
|
|
def test_get_scan_config_nvts_with_family(self): |
77
|
|
|
self.gmp.get_scan_config_nvts(family='family') |
78
|
|
|
|
79
|
|
|
self.connection.send.has_been_called_with('<get_nvts family="family"/>') |
80
|
|
|
|
81
|
|
|
def test_get_scan_config_nvts_with_sort_order(self): |
82
|
|
|
self.gmp.get_scan_config_nvts(sort_order='sort_order') |
83
|
|
|
|
84
|
|
|
self.connection.send.has_been_called_with( |
85
|
|
|
'<get_nvts sort_order="sort_order"/>' |
86
|
|
|
) |
87
|
|
|
|
88
|
|
|
def test_get_scan_config_nvts_with_sort_field(self): |
89
|
|
|
self.gmp.get_scan_config_nvts(sort_field='sort_field') |
90
|
|
|
|
91
|
|
|
self.connection.send.has_been_called_with( |
92
|
|
|
'<get_nvts sort_field="sort_field"/>' |
93
|
|
|
) |
94
|
|
|
|