|
| 1 | +# SPDX-FileCopyrightText: 2026 Greenbone AG |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | +# |
| 5 | + |
| 6 | +from gvm.errors import RequiredArgument |
| 7 | + |
| 8 | + |
| 9 | +class GmpGetScanReportTestMixin: |
| 10 | + def test_get_scan_report_without_id(self): |
| 11 | + with self.assertRaises(RequiredArgument): |
| 12 | + self.gmp.get_scan_report(None) |
| 13 | + |
| 14 | + with self.assertRaises(RequiredArgument): |
| 15 | + self.gmp.get_scan_report("") |
| 16 | + |
| 17 | + def test_get_scan_report_with_id(self): |
| 18 | + self.gmp.get_scan_report(scan_report_id="r1") |
| 19 | + |
| 20 | + self.connection.send.has_been_called_with( |
| 21 | + b'<get_scan_report scan_report_id="r1"/>' |
| 22 | + ) |
| 23 | + |
| 24 | + def test_get_scan_report_with_filter_string(self): |
| 25 | + self.gmp.get_scan_report( |
| 26 | + scan_report_id="r1", |
| 27 | + filter_string="name=foo", |
| 28 | + ) |
| 29 | + |
| 30 | + self.connection.send.has_been_called_with( |
| 31 | + b'<get_scan_report scan_report_id="r1" filter="name=foo"/>' |
| 32 | + ) |
| 33 | + |
| 34 | + def test_get_scan_report_with_filter_id(self): |
| 35 | + self.gmp.get_scan_report( |
| 36 | + scan_report_id="r1", |
| 37 | + filter_id="f1", |
| 38 | + ) |
| 39 | + |
| 40 | + self.connection.send.has_been_called_with( |
| 41 | + b'<get_scan_report scan_report_id="r1" filt_id="f1"/>' |
| 42 | + ) |
| 43 | + |
| 44 | + def test_get_scan_report_with_filter_string_and_filter_id(self): |
| 45 | + self.gmp.get_scan_report( |
| 46 | + scan_report_id="r1", |
| 47 | + filter_string="name=foo", |
| 48 | + filter_id="f1", |
| 49 | + ) |
| 50 | + |
| 51 | + self.connection.send.has_been_called_with( |
| 52 | + b'<get_scan_report scan_report_id="r1" ' |
| 53 | + b'filter="name=foo" filt_id="f1"/>' |
| 54 | + ) |
0 commit comments