-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathtest_create_container_task.py
More file actions
40 lines (32 loc) · 1.21 KB
/
test_create_container_task.py
File metadata and controls
40 lines (32 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# SPDX-FileCopyrightText: 2018-2025 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
from gvm.errors import RequiredArgument
class GmpCreateContainerTaskTestMixin:
def test_create_container_task_emits_deprecation_warning_and_sends_xml(
self,
):
with self.assertWarns(DeprecationWarning):
self.gmp.create_container_task(name="foo")
self.connection.send.has_been_called_with(
b"<create_task>"
b"<name>foo</name>"
b'<target id="0"/>'
b"</create_task>"
)
def test_create_container_task_missing_name(self):
with self.assertRaises(RequiredArgument):
self.gmp.create_container_task(name=None)
with self.assertRaises(RequiredArgument):
self.gmp.create_container_task(name="")
def test_create_container_task_with_comment_emits_warning(self):
with self.assertWarns(DeprecationWarning):
self.gmp.create_container_task(name="foo", comment="bar")
self.connection.send.has_been_called_with(
b"<create_task>"
b"<name>foo</name>"
b'<target id="0"/>'
b"<comment>bar</comment>"
b"</create_task>"
)