|
| 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 GmpGetReportErrorsTestMixin: |
| 10 | + def test_get_report_errors_without_id(self): |
| 11 | + with self.assertRaises(RequiredArgument): |
| 12 | + self.gmp.get_report_errors(None) |
| 13 | + |
| 14 | + with self.assertRaises(RequiredArgument): |
| 15 | + self.gmp.get_report_errors("") |
| 16 | + |
| 17 | + def test_get_report_errors_with_filter_string(self): |
| 18 | + self.gmp.get_report_errors(report_id="r1", filter_string="name=foo") |
| 19 | + |
| 20 | + self.connection.send.has_been_called_with( |
| 21 | + b'<get_report_errors report_id="r1" filter="name=foo" details="1"/>' |
| 22 | + ) |
| 23 | + |
| 24 | + def test_get_report_errors_with_filter_id(self): |
| 25 | + self.gmp.get_report_errors(report_id="r1", filter_id="f1") |
| 26 | + |
| 27 | + self.connection.send.has_been_called_with( |
| 28 | + b'<get_report_errors report_id="r1" filt_id="f1" details="1"/>' |
| 29 | + ) |
| 30 | + |
| 31 | + def test_get_report_errors_with_ignore_pagination(self): |
| 32 | + self.gmp.get_report_errors(report_id="r1", ignore_pagination=True) |
| 33 | + |
| 34 | + self.connection.send.has_been_called_with( |
| 35 | + b'<get_report_errors report_id="r1" ignore_pagination="1" details="1"/>' |
| 36 | + ) |
| 37 | + |
| 38 | + self.gmp.get_report_errors(report_id="r1", ignore_pagination=False) |
| 39 | + |
| 40 | + self.connection.send.has_been_called_with( |
| 41 | + b'<get_report_errors report_id="r1" ignore_pagination="0" details="1"/>' |
| 42 | + ) |
| 43 | + |
| 44 | + def test_get_report_errors_with_details(self): |
| 45 | + self.gmp.get_report_errors(report_id="r1", details=True) |
| 46 | + |
| 47 | + self.connection.send.has_been_called_with( |
| 48 | + b'<get_report_errors report_id="r1" details="1"/>' |
| 49 | + ) |
| 50 | + |
| 51 | + self.gmp.get_report_errors(report_id="r1", details=False) |
| 52 | + |
| 53 | + self.connection.send.has_been_called_with( |
| 54 | + b'<get_report_errors report_id="r1" details="0"/>' |
| 55 | + ) |
0 commit comments