diff --git a/CHANGELOG.md b/CHANGELOG.md index ab6c5fe0c..0e763c7a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] ### Added +* Added ignore_pagination and details arguments for get_report [PR 163](https://github.com/greenbone/python-gvm/pull/163) * Introducing Gmpv9 [PR 157](https://github.com/greenbone/python-gvm/pull/157) * Added new `create_audit` method, to create a task with the `usage_type` `audit` [PR 157](https://github.com/greenbone/python-gvm/pull/157) * Added new `create_policy` method, to create a config with the `usage_type` `policy` [PR 157](https://github.com/greenbone/python-gvm/pull/157) diff --git a/gvm/protocols/gmpv7/__init__.py b/gvm/protocols/gmpv7/__init__.py index 1d76c366a..243e65f5e 100644 --- a/gvm/protocols/gmpv7/__init__.py +++ b/gvm/protocols/gmpv7/__init__.py @@ -3407,7 +3407,9 @@ def get_report( filter: Optional[str] = None, filter_id: Optional[str] = None, delta_report_id: Optional[str] = None, - report_format_id: Optional[str] = None + report_format_id: Optional[str] = None, + ignore_pagination: Optional[bool] = None, + details: Optional[bool] = None ) -> Any: """Request a single report @@ -3417,6 +3419,9 @@ def get_report( filter_id: UUID of filter to use to filter results in the report delta_report_id: UUID of an existing report to compare report to. report_format_id: UUID of report format to use + ignore_pagination: Whether to ignore the filter terms "first" and + "rows". + details: Request addititional report information details Returns: The response. See :py:meth:`send_command` for details. @@ -3435,6 +3440,12 @@ def get_report( if report_format_id: cmd.set_attribute("format_id", report_format_id) + if ignore_pagination is not None: + cmd.set_attribute("ignore_pagination", _to_bool(ignore_pagination)) + + if details is not None: + cmd.set_attribute("details", _to_bool(details)) + return self._send_xml_command(cmd) def get_report_formats( diff --git a/tests/protocols/gmpv7/test_get_report.py b/tests/protocols/gmpv7/test_get_report.py index bcaac8faa..0a6c48722 100644 --- a/tests/protocols/gmpv7/test_get_report.py +++ b/tests/protocols/gmpv7/test_get_report.py @@ -59,6 +59,32 @@ def test_get_report_with_delta_report_id(self): '' ) + def test_get_report_with_ignore_pagination(self): + self.gmp.get_report(report_id='r1', ignore_pagination=True) + + self.connection.send.has_been_called_with( + '' + ) + + self.gmp.get_report(report_id='r1', ignore_pagination=False) + + self.connection.send.has_been_called_with( + '' + ) + + def test_get_report_with_details(self): + self.gmp.get_report(report_id='r1', details=True) + + self.connection.send.has_been_called_with( + '' + ) + + self.gmp.get_report(report_id='r1', details=False) + + self.connection.send.has_been_called_with( + '' + ) + if __name__ == '__main__': unittest.main()