Completed
Push — master ( a2d5c6...0c7412 )
by Juan José
13s
created

tests.test_gmp_protocol.GMPCreateTaskCommandTestCase.setUp()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
# -*- coding: utf-8 -*-
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
# Description:
3
# Testcases to test gmp protocol
4
#
5
# Authors:
6
# Michael Wiegand <[email protected]>
7
#
8
# Copyright:
9
# Copyright (C) 2018 Greenbone Networks GmbH
10
#
11
# This program is free software: you can redistribute it and/or modify
12
# it under the terms of the GNU General Public License as published by
13
# the Free Software Foundation, either version 3 of the License, or
14
# (at your option) any later version.
15
#
16
# This program is distributed in the hope that it will be useful,
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
# GNU General Public License for more details.
20
#
21
# You should have received a copy of the GNU General Public License
22
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
24
import unittest
25
from gmp.gmp import _gmp
26
27
class GMPCreateTaskCommandTestCase(unittest.TestCase):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
28
29
    TASK_NAME = "important task"
30
    CONFIG_ID = "cd0641e7-40b8-4e2c-811e-6b39d6d4b904"
31
    TARGET_ID = '267a3405-e84a-47da-97b2-5fa0d2e8995e'
32
    SCANNER_ID = 'b64c81b2-b9de-11e3-a2e9-406186ea4fc5'
33
    ALERT_ID = '3ab38c6a-30ac-407a-98db-ad6e74c98b9a'
34
    COMMENT = 'this task has been created for test purposes'
35
36
    def setUp(self):
37
        self.gmp = _gmp()
38
39
    def test_WithoutAlert_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_WithoutAlert_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
40
        cmd = self.gmp.createTaskCommand(
41
            self.TASK_NAME, self.CONFIG_ID, self.TARGET_ID, self.SCANNER_ID, comment=self.COMMENT)
42
43
        self.assertEqual('<create_task><name>{0}</name><comment>{1}</comment>' \
44
                         '<config id="{2}"/><target id="{3}"/><scanner id="{4}"/>' \
45
                         '</create_task>'.format(self.TASK_NAME,
46
                         self.COMMENT, self.CONFIG_ID, self.TARGET_ID, self.SCANNER_ID), cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 24 spaces).
Loading history...
47
48
    def test_SingleAlert_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_SingleAlert_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
49
        cmd = self.gmp.createTaskCommand(
50
            self.TASK_NAME, self.CONFIG_ID, self.TARGET_ID, self.SCANNER_ID,self.ALERT_ID, self.COMMENT)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (104/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
Coding Style introduced by
Exactly one space required after comma
Loading history...
51
52
        self.assertEqual('<create_task><name>{0}</name><comment>{1}</comment>' \
53
                         '<config id="{2}"/><target id="{3}"/><scanner id="{4}"/>' \
54
                         '<alert id="{5}"/></create_task>'.format(self.TASK_NAME,
55
                         self.COMMENT, self.CONFIG_ID, self.TARGET_ID, self.SCANNER_ID, self.ALERT_ID), cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 41 spaces).
Loading history...
Coding Style introduced by
This line is too long as per the coding-style (108/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
56
57
    def test_MultipleAlerts_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_MultipleAlerts_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
58
        alert_id2 = 'fb3d6f82-d706-4f99-9e53-d7d85257e25f'
59
        alert_id3 = 'a33864a9-d3fd-44b3-8717-972bfb01dfcf'
60
        alert_ids = [self.ALERT_ID, alert_id2, alert_id3]
61
        cmd = self.gmp.createTaskCommand(
62
            self.TASK_NAME, self.CONFIG_ID, self.TARGET_ID, self.SCANNER_ID, alert_ids, self.COMMENT)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (101/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
63
        self.assertEqual('<create_task><name>{0}</name><comment>{1}</comment>' \
64
                         '<config id="{2}"/><target id="{3}"/><scanner id="{4}"/>' \
65
                         '<alert id="{5}"/><alert id="{6}"/><alert id="{7}"/>' \
66
                         '</create_task>'.format(self.TASK_NAME,
67
                         self.COMMENT, self.CONFIG_ID, self.TARGET_ID, self.SCANNER_ID, self.ALERT_ID,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 24 spaces).
Loading history...
Coding Style introduced by
This line is too long as per the coding-style (102/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
68
                         alert_id2, alert_id3), cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 24 spaces).
Loading history...
69
70
class GMPCreateTargetCommandTestCase(unittest.TestCase):
0 ignored issues
show
best-practice introduced by
Too many public methods (27/20)
Loading history...
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
71
    TARGET_NAME = 'Unittest Target'
72
    TARGET_HOST = '127.0.0.1'
73
    COMMENT = 'This is a comment'
74
    UUID = '00000000-0000-0000-0000-000000000000'
75
    PORT = '1234'
76
    ALIVE_TEST = 'ICMP Ping'
77
    PORT_RANGE = 'T:10-20,U:10-30'
78
79
    def setUp(self):
80
        self.gmp = _gmp()
81
82
    def tearDown(self):
83
        pass
84
85
    def test_ValidNameMakeUniqueTrue_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_ValidNameMakeUniqueTrue_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
86
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
87
                                           True,
88
                                           {'hosts': self.TARGET_HOST})
89
90
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
91
                         '<make_unique>1</make_unique></name>'
92
                         '<hosts>' + self.TARGET_HOST + '</hosts>'
93
                         '</create_target>', cmd)
94
95
    def test_ValidNameMakeUniqueFalse_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_ValidNameMakeUniqueFalse_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
96
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
97
                                           False,
98
                                           {'hosts': self.TARGET_HOST})
99
100
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
101
                         '<make_unique>0</make_unique></name>'
102
                         '<hosts>' + self.TARGET_HOST + '</hosts>'
103
                         '</create_target>', cmd)
104
105
    def test_EmptyName_ValueError(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_EmptyName_ValueError does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
106
        with self.assertRaises(ValueError) as context:
107
            self.gmp.createTargetCommand("", True, {'hosts': self.TARGET_HOST})
108
109
        self.assertEqual('create_target requires a name element',
110
                         str(context.exception))
111
112
    def test_AssetHosts_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_AssetHosts_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
113
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
114
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
115
                {'asset_hosts': {'filter': self.TARGET_HOST}})
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
116
117
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
118
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
119
                '<asset_hosts filter="' + self.TARGET_HOST + '"/>'
120
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
121
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
122
123
    def test_NoHostNoAssetHosts_ValueError(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_NoHostNoAssetHosts_ValueError does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
124
        with self.assertRaises(ValueError) as context:
125
            self.gmp.createTargetCommand(self.TARGET_NAME, True, {})
126
127
        self.assertEqual('create_target requires either a hosts or '
128
                         'an asset_hosts element',
129
                         str(context.exception))
130
131
    def test_Comment_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_Comment_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
132
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
133
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
134
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
135
                    'hosts': self.TARGET_HOST,
136
                    'comment': self.COMMENT
137
                    })
138
139
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
140
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
141
                '<hosts>' + self.TARGET_HOST + '</hosts>'
142
                '<comment>' + self.COMMENT + '</comment>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
143
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
144
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
145
146
    def test_Copy_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_Copy_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
147
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
148
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
149
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
150
                    'hosts': self.TARGET_HOST,
151
                    'copy': self.UUID
152
                    })
153
154
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
155
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
156
                '<hosts>' + self.TARGET_HOST + '</hosts>'
157
                '<copy>' + self.UUID + '</copy>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
158
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
159
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
160
161
    def test_ExcludeHosts_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_ExcludeHosts_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
162
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
163
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
164
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
165
                    'hosts': self.TARGET_HOST,
166
                    'exclude_hosts': self.TARGET_HOST
167
                    })
168
169
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
170
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
171
                '<hosts>' + self.TARGET_HOST + '</hosts>'
172
                '<exclude_hosts>' + self.TARGET_HOST + '</exclude_hosts>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
173
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
174
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
175
176
    def test_SSHCredential_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_SSHCredential_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
177
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
178
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
179
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
180
                    'hosts': self.TARGET_HOST,
181
                    'ssh_credential':
182
                    {
183
                        'id': self.UUID
184
                        }
185
                    })
186
187
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
188
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
189
                '<hosts>' + self.TARGET_HOST + '</hosts>'
190
                '<ssh_credential id="' + self.UUID + '"></ssh_credential>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
191
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
192
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
193
194
    def test_SSHCredentialWithPort_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_SSHCredentialWithPort_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
195
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
196
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
197
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
198
                    'hosts': self.TARGET_HOST,
199
                    'ssh_credential':
200
                    {
201
                        'id': self.UUID,
202
                        'port': self.PORT
203
                        }
204
                    })
205
206
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
207
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
208
                '<hosts>' + self.TARGET_HOST + '</hosts>'
209
                '<ssh_credential id="' + self.UUID + '">'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
210
                '<port>' + self.PORT + '</port></ssh_credential>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
211
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
212
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
213
214
    def test_SSHCredentialNoID_ValueError(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_SSHCredentialNoID_ValueError does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
215
        with self.assertRaises(ValueError) as context:
216
            self.gmp.createTargetCommand(self.TARGET_NAME,
217
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
218
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
219
                    'hosts': self.TARGET_HOST,
220
                    'ssh_credential': {}
221
                    })
222
223
        self.assertEqual('ssh_credential requires an id attribute',
224
                str(context.exception))
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
225
226
    def test_SMBCredential_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_SMBCredential_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
227
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
228
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
229
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
230
                    'hosts': self.TARGET_HOST,
231
                    'smb_credential':
232
                    {
233
                        'id': self.UUID
234
                        }
235
                    })
236
237
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
238
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
239
                '<hosts>' + self.TARGET_HOST + '</hosts>'
240
                '<smb_credential id="' + self.UUID + '"/>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
241
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
242
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
243
244
    def test_SMBCredentialNoID_ValueError(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_SMBCredentialNoID_ValueError does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
245
        with self.assertRaises(ValueError) as context:
246
            self.gmp.createTargetCommand(self.TARGET_NAME,
247
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
248
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
249
                    'hosts': self.TARGET_HOST,
250
                    'smb_credential': {}
251
                    })
252
253
        self.assertEqual('smb_credential requires an id attribute',
254
                str(context.exception))
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
255
256
    def test_ESXiCredential_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_ESXiCredential_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
257
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
258
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
259
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
260
                    'hosts': self.TARGET_HOST,
261
                    'esxi_credential':
262
                    {
263
                        'id': self.UUID
264
                        }
265
                    })
266
267
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
268
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
269
                '<hosts>' + self.TARGET_HOST + '</hosts>'
270
                '<esxi_credential id="' + self.UUID + '"/>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
271
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
272
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
273
274
    def test_ESXiCredentialNoID_ValueError(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_ESXiCredentialNoID_ValueError does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
275
        with self.assertRaises(ValueError) as context:
276
            self.gmp.createTargetCommand(self.TARGET_NAME,
277
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
278
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
279
                    'hosts': self.TARGET_HOST,
280
                    'esxi_credential': {}
281
                    })
282
283
        self.assertEqual('esxi_credential requires an id attribute',
284
                str(context.exception))
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
285
286
    def test_SNMPCredential_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_SNMPCredential_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
287
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
288
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
289
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
290
                    'hosts': self.TARGET_HOST,
291
                    'snmp_credential':
292
                    {
293
                        'id': self.UUID
294
                        }
295
                    })
296
297
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
298
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
299
                '<hosts>' + self.TARGET_HOST + '</hosts>'
300
                '<snmp_credential id="' + self.UUID + '"/>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
301
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
302
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
303
304
    def test_SNMPCredentialNoID_ValueError(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_SNMPCredentialNoID_ValueError does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
305
        with self.assertRaises(ValueError) as context:
306
            self.gmp.createTargetCommand(self.TARGET_NAME,
307
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
308
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
309
                    'hosts': self.TARGET_HOST,
310
                    'snmp_credential': {}
311
                    })
312
313
        self.assertEqual('snmp_credential requires an id attribute',
314
                str(context.exception))
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
315
316
    def test_AliveTests_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_AliveTests_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
317
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
318
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
319
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
320
                    'hosts': self.TARGET_HOST,
321
                    'alive_tests': self.ALIVE_TEST
322
                    })
323
324
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
325
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
326
                '<hosts>' + self.TARGET_HOST + '</hosts>'
327
                '<alive_tests>' + self.ALIVE_TEST + '</alive_tests>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
328
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
329
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
330
331
    def test_ReverseLookupOnlyTrue_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_ReverseLookupOnlyTrue_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
332
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
333
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
334
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
335
                    'hosts': self.TARGET_HOST,
336
                    'reverse_lookup_only': True
337
                    })
338
339
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
340
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
341
                '<hosts>' + self.TARGET_HOST + '</hosts>'
342
                '<reverse_lookup_only>1</reverse_lookup_only>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
343
                '</create_target>',
344
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
345
346
    def test_ReverseLookupOnlyFalse_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_ReverseLookupOnlyFalse_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
347
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
348
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
349
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
350
                    'hosts': self.TARGET_HOST,
351
                    'reverse_lookup_only': False
352
                    })
353
354
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
355
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
356
                '<hosts>' + self.TARGET_HOST + '</hosts>'
357
                '<reverse_lookup_only>0</reverse_lookup_only>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
358
                '</create_target>',
359
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
360
361
    def test_ReverseLookupUnifyTrue_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_ReverseLookupUnifyTrue_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
362
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
363
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
364
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
365
                    'hosts': self.TARGET_HOST,
366
                    'reverse_lookup_unify': True
367
                    })
368
369
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
370
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
371
                '<hosts>' + self.TARGET_HOST + '</hosts>'
372
                '<reverse_lookup_unify>1</reverse_lookup_unify>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
373
                '</create_target>',
374
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
375
376
    def test_ReverseLookupUnifyFalse_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_ReverseLookupUnifyFalse_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
377
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
378
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
379
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
380
                    'hosts': self.TARGET_HOST,
381
                    'reverse_lookup_unify': False
382
                    })
383
384
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
385
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
386
                '<hosts>' + self.TARGET_HOST + '</hosts>'
387
                '<reverse_lookup_unify>0</reverse_lookup_unify>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
388
                '</create_target>',
389
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
390
391
    def test_PortRange_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_PortRange_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
392
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
393
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
394
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
395
                    'hosts': self.TARGET_HOST,
396
                    'port_range': self.PORT_RANGE
397
                    })
398
399
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
400
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
401
                '<hosts>' + self.TARGET_HOST + '</hosts>'
402
                '<port_range>' + self.PORT_RANGE + '</port_range>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
403
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
404
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
405
406
    def test_PortList_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_PortList_CorrectCmd does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
407
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
408
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
409
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
410
                    'hosts': self.TARGET_HOST,
411
                    'port_list':
412
                    {
413
                        'id': self.UUID
414
                        }
415
                    })
416
417
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
418
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
419
                '<hosts>' + self.TARGET_HOST + '</hosts>'
420
                '<port_list id="' + self.UUID + '"/>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
421
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
422
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
423
424
    def test_PortListNoID_ValueError(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_PortListNoID_ValueError does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
425
        with self.assertRaises(ValueError) as context:
426
            self.gmp.createTargetCommand(self.TARGET_NAME,
427
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
428
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
429
                    'hosts': self.TARGET_HOST,
430
                    'port_list': {}
431
                    })
432
433
        self.assertEqual('port_list requires an id attribute',
434
                str(context.exception))
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
435
436
437
class GMPCreateReportCommandTestCase(unittest.TestCase):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
438
    TASK_ID = '00000000-0000-0000-0000-000000000001'
439
    TASK_NAME = 'unit test task'
440
    COMMENT = 'This is a comment'
441
    REPORT_XML_STRING = (
442
        '<report id="67a62fb7-b238-4f0e-bc48-59bde8939cdc"><results max="1"' +
443
        ' start="1"><result id="f180b40f-49dd-4856-81ed-8c1195afce80">' +
444
        '<severity>0.0</severity><nvt oid="1.3.6.1.4.1.25623.1.0.10330"/>' +
445
        '<host>132.67.253.114</host></result></results></report>'
446
    )
447
448
    def setUp(self):
449
        self.gmp = _gmp()
450
451
    def tearDown(self):
452
        pass
453
454
    def test_Create_ReportCmd_Taskid(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_Create_ReportCmd_Taskid does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
455
        cmd = self.gmp.createReportCommand(self.REPORT_XML_STRING,
456
                                           {
457
                                               'task_id': self.TASK_ID,
458
                                           })
459
460
        self.assertEqual('<create_report><task id="' + self.TASK_ID + '"/>' +
461
                         self.REPORT_XML_STRING + '</create_report>',
462
                         cmd)
463
464
    def test_Create_ReportCmd_Taskname(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_Create_ReportCmd_Taskname does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
465
        cmd = self.gmp.createReportCommand(self.REPORT_XML_STRING,
466
                                           {
467
                                               'task_name': self.TASK_NAME,
468
                                               'comment': self.COMMENT,
469
                                           })
470
471
        self.assertEqual('<create_report><task>' +
472
                         '<name>' + self.TASK_NAME + '</name>' +
473
                         '<comment>' + self.COMMENT + '</comment>' +
474
                         '</task>' + self.REPORT_XML_STRING + '</create_report>',
475
                         cmd)
476
477
    def test_Create_ReportCmd_noreport(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_Create_ReportCmd_noreport does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
478
        NO_REPORT = None
0 ignored issues
show
Coding Style Naming introduced by
The name NO_REPORT does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
479
        args = {
480
            'task_name': self.TASK_NAME,
481
            'comment': self.COMMENT,
482
        }
483
484
        self.assertRaises(ValueError,
485
                          self.gmp.createReportCommand,
486
                          NO_REPORT,
487
                          args
488
        )
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 17 spaces).
Loading history...
489
490
    def test_Create_ReportCmd_notask(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_Create_ReportCmd_notask does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
491
        args = {'comment': self.COMMENT}
492
        self.assertRaises(ValueError,
493
                          self.gmp.createReportCommand,
494
                          self.REPORT_XML_STRING,
495
                          args
496
        )
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 17 spaces).
Loading history...
497
498
if __name__ == '__main__':
499
    unittest.main()
500