Skip to content

Commit

Permalink
Merge branch 'master' into print-warning
Browse files Browse the repository at this point in the history
  • Loading branch information
y0urself authored Nov 13, 2020
2 parents bf57aaa + d635e58 commit 89fabbe
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion gvm/protocols/gmpv9/gmpv9.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 - 2019 Greenbone Networks GmbH
# Copyright (C) 2018 - 2020 Greenbone Networks GmbH
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
Expand Down
44 changes: 22 additions & 22 deletions tests/protocols/gmpv9/testcmds/test_modify_audit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Greenbone Networks GmbH
# Copyright (C) 2020 Greenbone Networks GmbH
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
Expand All @@ -22,7 +22,7 @@

from gvm.errors import RequiredArgument, InvalidArgument, InvalidArgumentType

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


class GmpModifyAuditCommandTestCase:
Expand All @@ -31,7 +31,7 @@ def test_modify_task(self):

self.connection.send.has_been_called_with('<modify_task task_id="t1"/>')

def test_modify_task_missing_task_id(self):
def test_modify_audit_missing_task_id(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_audit(None)

Expand All @@ -41,42 +41,42 @@ def test_modify_task_missing_task_id(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_audit(audit_id='')

def test_modify_task_with_name(self):
def test_modify_audit_with_name(self):
self.gmp.modify_audit(audit_id='t1', name='foo')

self.connection.send.has_been_called_with(
'<modify_task task_id="t1">' '<name>foo</name>' '</modify_task>'
)

def test_modify_task_with_policy_id(self):
def test_modify_audit_with_policy_id(self):
self.gmp.modify_audit(audit_id='t1', policy_id='c1')

self.connection.send.has_been_called_with(
'<modify_task task_id="t1">' '<config id="c1"/>' '</modify_task>'
)

def test_modify_task_with_target_id(self):
def test_modify_audit_with_target_id(self):
self.gmp.modify_audit(audit_id='t1', target_id='t1')

self.connection.send.has_been_called_with(
'<modify_task task_id="t1">' '<target id="t1"/>' '</modify_task>'
)

def test_modify_task_with_scanner_id(self):
def test_modify_audit_with_scanner_id(self):
self.gmp.modify_audit(audit_id='t1', scanner_id='s1')

self.connection.send.has_been_called_with(
'<modify_task task_id="t1">' '<scanner id="s1"/>' '</modify_task>'
)

def test_modify_task_with_schedule_id(self):
def test_modify_audit_with_schedule_id(self):
self.gmp.modify_audit(audit_id='t1', schedule_id='s1')

self.connection.send.has_been_called_with(
'<modify_task task_id="t1">' '<schedule id="s1"/>' '</modify_task>'
)

def test_modify_task_with_comment(self):
def test_modify_audit_with_comment(self):
self.gmp.modify_audit(audit_id='t1', comment='bar')

self.connection.send.has_been_called_with(
Expand All @@ -85,7 +85,7 @@ def test_modify_task_with_comment(self):
'</modify_task>'
)

def test_modify_task_with_alerts_ids(self):
def test_modify_audit_with_alerts_ids(self):
self.gmp.modify_audit(audit_id='t1', alert_ids=['a1', 'a2', 'a3'])

self.connection.send.has_been_called_with(
Expand All @@ -96,21 +96,21 @@ def test_modify_task_with_alerts_ids(self):
'</modify_task>'
)

def test_modify_task_invalid_alerts_ids(self):
def test_modify_audit_invalid_alerts_ids(self):
with self.assertRaises(InvalidArgumentType):
self.gmp.modify_audit(audit_id='t1', alert_ids='')

with self.assertRaises(InvalidArgumentType):
self.gmp.modify_audit(audit_id='t1', alert_ids='a1')

def test_modify_task_with_empty_alert_ids(self):
def test_modify_audit_with_empty_alert_ids(self):
self.gmp.modify_audit(audit_id='t1', alert_ids=[])

self.connection.send.has_been_called_with(
'<modify_task task_id="t1">' '<alert id="0"/>' '</modify_task>'
)

def test_modify_task_with_alterable(self):
def test_modify_audit_with_alterable(self):
self.gmp.modify_audit(audit_id='t1', alterable=True)

self.connection.send.has_been_called_with(
Expand All @@ -127,7 +127,7 @@ def test_modify_task_with_alterable(self):
'</modify_task>'
)

def test_modify_task_with_hosts_ordering(self):
def test_modify_audit_with_hosts_ordering(self):
self.gmp.modify_audit(
audit_id='t1', hosts_ordering=HostsOrdering.REVERSE
)
Expand All @@ -138,18 +138,18 @@ def test_modify_task_with_hosts_ordering(self):
'</modify_task>'
)

def test_modify_task_invalid_hosts_ordering(self):
def test_modify_audit_invalid_hosts_ordering(self):
with self.assertRaises(InvalidArgumentType):
self.gmp.modify_audit(audit_id='t1', hosts_ordering='foo')

def test_modify_task_with_schedule(self):
def test_modify_audit_with_schedule(self):
self.gmp.modify_audit(audit_id='t1', schedule_id='s1')

self.connection.send.has_been_called_with(
'<modify_task task_id="t1">' '<schedule id="s1"/>' '</modify_task>'
)

def test_modify_task_with_schedule_periods(self):
def test_modify_audit_with_schedule_periods(self):
self.gmp.modify_audit(audit_id='t1', schedule_periods=0)

self.connection.send.has_been_called_with(
Expand All @@ -166,14 +166,14 @@ def test_modify_task_with_schedule_periods(self):
'</modify_task>'
)

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='foo')

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

def test_modify_task_with_observers(self):
def test_modify_audit_with_observers(self):
self.gmp.modify_audit(audit_id='t1', observers=['u1', 'u2'])

self.connection.send.has_been_called_with(
Expand All @@ -182,14 +182,14 @@ def test_modify_task_with_observers(self):
'</modify_task>'
)

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='')

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

def test_modify_task_with_preferences(self):
def test_modify_audit_with_preferences(self):
self.gmp.modify_audit(
audit_id='t1',
preferences=OrderedDict([('foo', 'bar'), ('lorem', 'ipsum')]),
Expand All @@ -210,7 +210,7 @@ def test_modify_task_with_preferences(self):
'</modify_task>'
)

def test_modify_task_invalid_preferences(self):
def test_modify_audit_invalid_preferences(self):
with self.assertRaises(InvalidArgumentType):
self.gmp.modify_audit(audit_id='t1', preferences='')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Greenbone Networks GmbH
# Copyright (C) 2020 Greenbone Networks GmbH
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
Expand All @@ -22,7 +22,7 @@


class GmpModifyPolicySetCommentTestCase:
def test_modify_config_set_comment(self):
def test_modify_policy_set_comment(self):
self.gmp.modify_policy_set_comment('c1')

self.connection.send.has_been_called_with(
Expand All @@ -45,7 +45,7 @@ def test_modify_config_set_comment(self):
'<modify_config config_id="c1">' '<comment/>' '</modify_config>'
)

def test_modify_config_set_comment_missing_config_id(self):
def test_modify_policy_set_comment_missing_config_id(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_policy_set_comment(policy_id=None)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Greenbone Networks GmbH
# Copyright (C) 2020 Greenbone Networks GmbH
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
Expand All @@ -22,7 +22,7 @@


class GmpModifyPolicySetFamilySelectionTestCase:
def test_modify_config_set_family_selection(self):
def test_modify_policy_set_family_selection(self):
self.gmp.modify_policy_set_family_selection(
policy_id='c1', families=['foo']
)
Expand Down Expand Up @@ -84,7 +84,7 @@ def test_modify_config_set_family_selection(self):
'</modify_config>'
)

def test_modify_config_set_family_selection_missing_config_id(self):
def test_modify_policy_set_family_selection_missing_config_id(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_policy_set_family_selection(
policy_id=None, families=['foo']
Expand All @@ -98,7 +98,7 @@ def test_modify_config_set_family_selection_missing_config_id(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_policy_set_family_selection('', ['foo'])

def test_modify_config_set_family_selection_invalid_families(self):
def test_modify_policy_set_family_selection_invalid_families(self):
with self.assertRaises(InvalidArgumentType):
self.gmp.modify_policy_set_family_selection(
policy_id='c1', families=None
Expand All @@ -112,7 +112,7 @@ def test_modify_config_set_family_selection_invalid_families(self):
with self.assertRaises(InvalidArgumentType):
self.gmp.modify_policy_set_family_selection('c1', '')

def test_modify_config_set_family_selection_with_auto_add_new_families(
def test_modify_policy_set_family_selection_with_auto_add_new_families(
self,
):
self.gmp.modify_policy_set_family_selection(
Expand Down Expand Up @@ -149,7 +149,7 @@ def test_modify_config_set_family_selection_with_auto_add_new_families(
'</modify_config>'
)

def test_modify_config_set_family_selection_with_auto_add_new_nvts(self):
def test_modify_policy_set_family_selection_with_auto_add_new_nvts(self):
self.gmp.modify_policy_set_family_selection(
policy_id='c1', families=['foo'], auto_add_new_nvts=True
)
Expand Down
6 changes: 3 additions & 3 deletions tests/protocols/gmpv9/testcmds/test_modify_policy_set_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


class GmpModifyPolicySetNameTestCase:
def test_modify_config_set_name(self):
def test_modify_policy_set_name(self):
self.gmp.modify_policy_set_name('c1', 'foo')

self.connection.send.has_been_called_with(
Expand All @@ -31,7 +31,7 @@ def test_modify_config_set_name(self):
'</modify_config>'
)

def test_modify_config_set_name_missing_config_id(self):
def test_modify_policy_set_name_missing_config_id(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_policy_set_name(policy_id=None, name='name')

Expand All @@ -41,7 +41,7 @@ def test_modify_config_set_name_missing_config_id(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_policy_set_name(policy_id='', name='name')

def test_modify_config_set_name_missing_name(self):
def test_modify_policy_set_name_missing_name(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_policy_set_name(policy_id='c', name='')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Greenbone Networks GmbH
# Copyright (C) 2020 Greenbone Networks GmbH
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
Expand All @@ -22,7 +22,7 @@


class GmpModifyPolicySetNvtPreferenceTestCase:
def test_modify_config_set_nvt_pref(self):
def test_modify_policy_set_nvt_pref(self):
self.gmp.modify_policy_set_nvt_preference(
policy_id='c1', nvt_oid='o1', name='foo'
)
Expand All @@ -47,7 +47,7 @@ def test_modify_config_set_nvt_pref(self):
'</modify_config>'
)

def test_modify_config_set_nvt_pref_with_value(self):
def test_modify_policy_set_nvt_pref_with_value(self):
self.gmp.modify_policy_set_nvt_preference(
'c1', 'foo', nvt_oid='o1', value='bar'
)
Expand All @@ -62,7 +62,7 @@ def test_modify_config_set_nvt_pref_with_value(self):
'</modify_config>'
)

def test_modify_config_set_nvt_pref_missing_nvt_oid(self):
def test_modify_policy_set_nvt_pref_missing_nvt_oid(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_policy_set_nvt_preference(
'c1', 'foo', nvt_oid=None, value='bar'
Expand All @@ -78,7 +78,7 @@ def test_modify_config_set_nvt_pref_missing_nvt_oid(self):
'c1', 'foo', '', value='bar'
)

def test_modify_config_nvt_pref_missing_name(self):
def test_modify_policy_nvt_pref_missing_name(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_policy_set_nvt_preference(
'c1', name=None, nvt_oid='o1', value='bar'
Expand All @@ -94,7 +94,7 @@ def test_modify_config_nvt_pref_missing_name(self):
'c1', '', nvt_oid='o1', value='bar'
)

def test_modify_config_set_comment_missing_config_id(self):
def test_modify_policy_set_comment_missing_config_id(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_policy_set_nvt_preference(
policy_id=None, name='foo', nvt_oid='o1'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Greenbone Networks GmbH
# Copyright (C) 2020 Greenbone Networks GmbH
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
Expand All @@ -22,7 +22,7 @@


class GmpModifyPolicySetNvtSelectionTestCase:
def test_modify_config_set_nvt_selection(self):
def test_modify_policy_set_nvt_selection(self):
self.gmp.modify_policy_set_nvt_selection(
policy_id='c1', family='foo', nvt_oids=['o1']
)
Expand Down Expand Up @@ -85,7 +85,7 @@ def test_modify_config_set_nvt_selection(self):
'</modify_config>'
)

def test_modify_config_set_nvt_selection_missing_config_id(self):
def test_modify_policy_set_nvt_selection_missing_config_id(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_policy_set_nvt_selection(
policy_id=None, family='foo', nvt_oids=['o1']
Expand All @@ -99,7 +99,7 @@ def test_modify_config_set_nvt_selection_missing_config_id(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_policy_set_nvt_selection('', 'foo', ['o1'])

def test_modify_config_set_nvt_selection_missing_family(self):
def test_modify_policy_set_nvt_selection_missing_family(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_policy_set_nvt_selection(
policy_id='c1', family=None, nvt_oids=['o1']
Expand All @@ -113,7 +113,7 @@ def test_modify_config_set_nvt_selection_missing_family(self):
with self.assertRaises(RequiredArgument):
self.gmp.modify_policy_set_nvt_selection('c1', '', ['o1'])

def test_modify_config_set_nvt_selection_invalid_nvt_oids(self):
def test_modify_policy_set_nvt_selection_invalid_nvt_oids(self):
with self.assertRaises(InvalidArgumentType):
self.gmp.modify_policy_set_nvt_selection(
policy_id='c1', family='foo', nvt_oids=None
Expand Down
Loading

0 comments on commit 89fabbe

Please sign in to comment.