Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify audit and policy #332

Merged
merged 9 commits into from
Nov 12, 2020
Merged

Conversation

y0urself
Copy link
Member

@y0urself y0urself commented Nov 11, 2020

What:

Added modifiers for Audits and Policies:

  • modify_audits
  • modify_policy_set_nvt_preference
  • modify_policy_set_name
  • modify_policy_set_comment
  • modify_policy_set_scanner_preference
  • modify_policy_set_nvt_selection
  • modify_policy_set_family_selection

Why:

These API calls are missing.

How:

Using the modify_task and modify_config_

Checklist:

@codecov
Copy link

codecov bot commented Nov 11, 2020

Codecov Report

Merging #332 (da6640e) into master (a7ad2f5) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #332   +/-   ##
=======================================
  Coverage   97.46%   97.47%           
=======================================
  Files          20       20           
  Lines        4221     4235   +14     
=======================================
+ Hits         4114     4128   +14     
  Misses        107      107           
Impacted Files Coverage Δ
gvm/protocols/gmpv9/gmpv9.py 97.47% <100.00%> (+0.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a7ad2f5...da6640e. Read the comment docs.

@y0urself y0urself marked this pull request as ready for review November 11, 2020 10:32
@y0urself y0urself requested a review from a team as a code owner November 11, 2020 10:32
@y0urself y0urself merged commit bd27558 into greenbone:master Nov 12, 2020
Copy link
Contributor

@bjoernricks bjoernricks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry i wasn't fast enough. The PR contains a lot of copy&paste mistakes.

@@ -0,0 +1,222 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Greenbone Networks GmbH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Copyright (C) 2018 Greenbone Networks GmbH
# Copyright (C) 2020 Greenbone Networks GmbH


from gvm.errors import RequiredArgument, InvalidArgument, InvalidArgumentType

from gvm.protocols.gmpv7 import HostsOrdering
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from gvm.protocols.gmpv7 import HostsOrdering
from gvm.protocols.gmpv9 import HostsOrdering

@@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Greenbone Networks GmbH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Copyright (C) 2018 Greenbone Networks GmbH
# Copyright (C) 2020 Greenbone Networks GmbH

@@ -0,0 +1,189 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Greenbone Networks GmbH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Copyright (C) 2018 Greenbone Networks GmbH
# Copyright (C) 2020 Greenbone Networks GmbH

@@ -0,0 +1,113 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Greenbone Networks GmbH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Copyright (C) 2018 Greenbone Networks GmbH
# Copyright (C) 2020 Greenbone Networks GmbH

'</modify_task>'
)

def test_modify_task_invalid_schedule_periods(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_modify_task_invalid_schedule_periods(self):
def test_modify_audit_invalid_schedule_periods(self):

with self.assertRaises(InvalidArgument):
self.gmp.modify_audit(audit_id='t1', schedule_periods=-1)

def test_modify_task_with_observers(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_modify_task_with_observers(self):
def test_modify_audit_with_observers(self):

'</modify_task>'
)

def test_modify_task_invalid_observers(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_modify_task_invalid_observers(self):
def test_modify_audit_invalid_observers(self):

with self.assertRaises(InvalidArgumentType):
self.gmp.modify_audit(audit_id='t1', observers='foo')

def test_modify_task_with_preferences(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_modify_task_with_preferences(self):
def test_modify_audit_with_preferences(self):

'</modify_task>'
)

def test_modify_task_invalid_preferences(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_modify_task_invalid_preferences(self):
def test_modify_audit_invalid_preferences(self):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants