Passed
Pull Request — master (#84)
by
unknown
01:33
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 GMPCreateFilterCommandTestCase(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
    FILTER_NAME = "special filter"
29
30
    def setUp(self):
31
        self.gmp = _gmp()
32
33
    def test_AllAvailableFilters_CorrectCmd(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_AllAvailableFilters_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...
34
        for filter_name in self.gmp.FILTER_NAMES:
35
            cmd = self.gmp.createFilterCommand(name=self.FILTER_NAME, make_unique="True",
36
                  kwargs={'term': 'sort-reverse=threat result_hosts_only=1 notes=1 \
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 29 spaces).
Loading history...
37
                  overrides=1 levels=hml first=1 rows=1000', 'type': filter_name})
38
            self.assertEqual('<create_filter><name>{0}<make_unique>True'\
39
                             '</make_unique></name><term>sort-reverse=threat '\
40
                             'result_hosts_only=1 notes=1                   '\
41
                             'overrides=1 levels=hml first=1 rows=1000</term>'\
42
                             '<type>{1}</type></create_filter>'.format(self.FILTER_NAME,
43
                             filter_name),cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 42 spaces).
Loading history...
Coding Style introduced by
Exactly one space required after comma
Loading history...
44
45
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...
46
47
    TASK_NAME = "important task"
48
    CONFIG_ID = "cd0641e7-40b8-4e2c-811e-6b39d6d4b904"
49
    TARGET_ID = '267a3405-e84a-47da-97b2-5fa0d2e8995e'
50
    SCANNER_ID = 'b64c81b2-b9de-11e3-a2e9-406186ea4fc5'
51
    ALERT_ID = '3ab38c6a-30ac-407a-98db-ad6e74c98b9a'
52
    COMMENT = 'this task has been created for test purposes'
53
54
    def setUp(self):
55
        self.gmp = _gmp()
56
57
    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...
58
        cmd = self.gmp.createTaskCommand(
59
            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...
60
61
        self.assertEqual('<create_task><name>{0}</name><comment>{1}</comment>' \
62
                         '<config id="{2}"/><target id="{3}"/><scanner id="{4}"/>' \
63
                         '<alert id="{5}"/></create_task>'.format(self.TASK_NAME, 
0 ignored issues
show
Coding Style introduced by
Trailing whitespace
Loading history...
64
                         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...
65
66
    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...
67
        alert_id2 = 'fb3d6f82-d706-4f99-9e53-d7d85257e25f'
68
        alert_id3 = 'a33864a9-d3fd-44b3-8717-972bfb01dfcf'
69
        alert_ids = [self.ALERT_ID, alert_id2, alert_id3]
70
        cmd = self.gmp.createTaskCommand(
71
            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...
72
        self.assertEqual('<create_task><name>{0}</name><comment>{1}</comment>' \
73
                         '<config id="{2}"/><target id="{3}"/><scanner id="{4}"/>' \
74
                         '<alert id="{5}"/><alert id="{6}"/><alert id="{7}"/>' \
75
                         '</create_task>'.format(self.TASK_NAME, 
0 ignored issues
show
Coding Style introduced by
Trailing whitespace
Loading history...
76
                         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
Trailing whitespace
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...
77
                         alert_id2, alert_id3), cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 24 spaces).
Loading history...
78
79
class GMPCreateTargetCommandTestCase(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...
best-practice introduced by
Too many public methods (27/20)
Loading history...
80
    TARGET_NAME = 'Unittest Target'
81
    TARGET_HOST = '127.0.0.1'
82
    COMMENT = 'This is a comment'
83
    UUID = '00000000-0000-0000-0000-000000000000'
84
    PORT = '1234'
85
    ALIVE_TEST = 'ICMP Ping'
86
    PORT_RANGE = 'T:10-20,U:10-30'
87
88
    def setUp(self):
89
        self.gmp = _gmp()
90
91
    def tearDown(self):
92
        pass
93
94
    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...
95
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
96
                                           True,
97
                                           {'hosts': self.TARGET_HOST})
98
99
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
100
                         '<make_unique>1</make_unique></name>'
101
                         '<hosts>' + self.TARGET_HOST + '</hosts>'
102
                         '</create_target>', cmd)
103
104
    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...
105
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
106
                                           False,
107
                                           {'hosts': self.TARGET_HOST})
108
109
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
110
                         '<make_unique>0</make_unique></name>'
111
                         '<hosts>' + self.TARGET_HOST + '</hosts>'
112
                         '</create_target>', cmd)
113
114
    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...
115
        with self.assertRaises(ValueError) as context:
116
            self.gmp.createTargetCommand("", True, {'hosts': self.TARGET_HOST})
117
118
        self.assertEqual('create_target requires a name element',
119
                         str(context.exception))
120
121
    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...
122
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
123
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
124
                {'asset_hosts': {'filter': self.TARGET_HOST}})
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
125
126
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
127
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
128
                '<asset_hosts filter="' + self.TARGET_HOST + '"/>'
129
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
130
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
131
132
    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...
133
        with self.assertRaises(ValueError) as context:
134
            self.gmp.createTargetCommand(self.TARGET_NAME, True, {})
135
136
        self.assertEqual('create_target requires either a hosts or '
137
                         'an asset_hosts element',
138
                         str(context.exception))
139
140
    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...
141
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
142
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
143
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
144
                    'hosts': self.TARGET_HOST,
145
                    'comment': self.COMMENT
146
                    })
147
148
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
149
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
150
                '<hosts>' + self.TARGET_HOST + '</hosts>'
151
                '<comment>' + self.COMMENT + '</comment>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
152
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
153
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
154
155
    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...
156
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
157
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
158
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
159
                    'hosts': self.TARGET_HOST,
160
                    'copy': self.UUID
161
                    })
162
163
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
164
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
165
                '<hosts>' + self.TARGET_HOST + '</hosts>'
166
                '<copy>' + self.UUID + '</copy>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
167
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
168
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
169
170
    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...
171
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
172
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
173
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
174
                    'hosts': self.TARGET_HOST,
175
                    'exclude_hosts': self.TARGET_HOST
176
                    })
177
178
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
179
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
180
                '<hosts>' + self.TARGET_HOST + '</hosts>'
181
                '<exclude_hosts>' + self.TARGET_HOST + '</exclude_hosts>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
182
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
183
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
184
185
    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...
186
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
187
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
188
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
189
                    'hosts': self.TARGET_HOST,
190
                    'ssh_credential':
191
                    {
192
                        'id': self.UUID
193
                        }
194
                    })
195
196
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
197
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
198
                '<hosts>' + self.TARGET_HOST + '</hosts>'
199
                '<ssh_credential id="' + self.UUID + '"></ssh_credential>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
200
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
201
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
202
203
    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...
204
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
205
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
206
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
207
                    'hosts': self.TARGET_HOST,
208
                    'ssh_credential':
209
                    {
210
                        'id': self.UUID,
211
                        'port': self.PORT
212
                        }
213
                    })
214
215
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
216
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
217
                '<hosts>' + self.TARGET_HOST + '</hosts>'
218
                '<ssh_credential id="' + self.UUID + '">'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
219
                '<port>' + self.PORT + '</port></ssh_credential>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
220
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
221
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
222
223
    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...
224
        with self.assertRaises(ValueError) as context:
225
            self.gmp.createTargetCommand(self.TARGET_NAME,
226
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
227
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
228
                    'hosts': self.TARGET_HOST,
229
                    'ssh_credential': {}
230
                    })
231
232
        self.assertEqual('ssh_credential requires an id attribute',
233
                str(context.exception))
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
234
235
    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...
236
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
237
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
238
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
239
                    'hosts': self.TARGET_HOST,
240
                    'smb_credential':
241
                    {
242
                        'id': self.UUID
243
                        }
244
                    })
245
246
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
247
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
248
                '<hosts>' + self.TARGET_HOST + '</hosts>'
249
                '<smb_credential id="' + self.UUID + '"/>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
250
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
251
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
252
253
    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...
254
        with self.assertRaises(ValueError) as context:
255
            self.gmp.createTargetCommand(self.TARGET_NAME,
256
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
257
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
258
                    'hosts': self.TARGET_HOST,
259
                    'smb_credential': {}
260
                    })
261
262
        self.assertEqual('smb_credential requires an id attribute',
263
                str(context.exception))
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
264
265
    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...
266
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
267
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
268
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
269
                    'hosts': self.TARGET_HOST,
270
                    'esxi_credential':
271
                    {
272
                        'id': self.UUID
273
                        }
274
                    })
275
276
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
277
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
278
                '<hosts>' + self.TARGET_HOST + '</hosts>'
279
                '<esxi_credential id="' + self.UUID + '"/>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
280
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
281
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
282
283
    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...
284
        with self.assertRaises(ValueError) as context:
285
            self.gmp.createTargetCommand(self.TARGET_NAME,
286
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
287
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
288
                    'hosts': self.TARGET_HOST,
289
                    'esxi_credential': {}
290
                    })
291
292
        self.assertEqual('esxi_credential requires an id attribute',
293
                str(context.exception))
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
294
295
    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...
296
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
297
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
298
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
299
                    'hosts': self.TARGET_HOST,
300
                    'snmp_credential':
301
                    {
302
                        'id': self.UUID
303
                        }
304
                    })
305
306
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
307
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
308
                '<hosts>' + self.TARGET_HOST + '</hosts>'
309
                '<snmp_credential id="' + self.UUID + '"/>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
310
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
311
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
312
313
    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...
314
        with self.assertRaises(ValueError) as context:
315
            self.gmp.createTargetCommand(self.TARGET_NAME,
316
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
317
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
318
                    'hosts': self.TARGET_HOST,
319
                    'snmp_credential': {}
320
                    })
321
322
        self.assertEqual('snmp_credential requires an id attribute',
323
                str(context.exception))
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
324
325
    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...
326
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
327
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
328
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
329
                    'hosts': self.TARGET_HOST,
330
                    'alive_tests': self.ALIVE_TEST
331
                    })
332
333
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
334
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
335
                '<hosts>' + self.TARGET_HOST + '</hosts>'
336
                '<alive_tests>' + self.ALIVE_TEST + '</alive_tests>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
337
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
338
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
339
340
    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...
341
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
342
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
343
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
344
                    'hosts': self.TARGET_HOST,
345
                    'reverse_lookup_only': True
346
                    })
347
348
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
349
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
350
                '<hosts>' + self.TARGET_HOST + '</hosts>'
351
                '<reverse_lookup_only>1</reverse_lookup_only>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
352
                '</create_target>',
353
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
354
355
    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...
356
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
357
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
358
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
359
                    'hosts': self.TARGET_HOST,
360
                    'reverse_lookup_only': False
361
                    })
362
363
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
364
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
365
                '<hosts>' + self.TARGET_HOST + '</hosts>'
366
                '<reverse_lookup_only>0</reverse_lookup_only>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
367
                '</create_target>',
368
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
369
370
    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...
371
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
372
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
373
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
374
                    'hosts': self.TARGET_HOST,
375
                    'reverse_lookup_unify': True
376
                    })
377
378
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
379
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
380
                '<hosts>' + self.TARGET_HOST + '</hosts>'
381
                '<reverse_lookup_unify>1</reverse_lookup_unify>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
382
                '</create_target>',
383
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
384
385
    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...
386
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
387
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
388
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
389
                    'hosts': self.TARGET_HOST,
390
                    'reverse_lookup_unify': False
391
                    })
392
393
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
394
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
395
                '<hosts>' + self.TARGET_HOST + '</hosts>'
396
                '<reverse_lookup_unify>0</reverse_lookup_unify>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
397
                '</create_target>',
398
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
399
400
    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...
401
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
402
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
403
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
404
                    'hosts': self.TARGET_HOST,
405
                    'port_range': self.PORT_RANGE
406
                    })
407
408
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
409
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
410
                '<hosts>' + self.TARGET_HOST + '</hosts>'
411
                '<port_range>' + self.PORT_RANGE + '</port_range>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
412
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
413
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
414
415
    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...
416
        cmd = self.gmp.createTargetCommand(self.TARGET_NAME,
417
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
418
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 27 spaces).
Loading history...
419
                    'hosts': self.TARGET_HOST,
420
                    'port_list':
421
                    {
422
                        'id': self.UUID
423
                        }
424
                    })
425
426
        self.assertEqual('<create_target><name>' + self.TARGET_NAME +
427
                '<make_unique>1</make_unique></name>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
428
                '<hosts>' + self.TARGET_HOST + '</hosts>'
429
                '<port_list id="' + self.UUID + '"/>'
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
430
                '</create_target>',
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation.
Loading history...
431
                cmd)
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
432
433
    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...
434
        with self.assertRaises(ValueError) as context:
435
            self.gmp.createTargetCommand(self.TARGET_NAME,
436
                True,
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
437
                {
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 25 spaces).
Loading history...
438
                    'hosts': self.TARGET_HOST,
439
                    'port_list': {}
440
                    })
441
442
        self.assertEqual('port_list requires an id attribute',
443
                str(context.exception))
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 9 spaces).
Loading history...
444
445
446
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...
447
    TASK_ID = '00000000-0000-0000-0000-000000000001'
448
    TASK_NAME = 'unit test task'
449
    COMMENT = 'This is a comment'
450
    REPORT_XML_STRING = (
451
        '<report id="67a62fb7-b238-4f0e-bc48-59bde8939cdc"><results max="1"' +
452
        ' start="1"><result id="f180b40f-49dd-4856-81ed-8c1195afce80">' +
453
        '<severity>0.0</severity><nvt oid="1.3.6.1.4.1.25623.1.0.10330"/>' +
454
        '<host>132.67.253.114</host></result></results></report>'
455
    )
456
457
    def setUp(self):
458
        self.gmp = _gmp()
459
460
    def tearDown(self):
461
        pass
462
463
    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...
464
        cmd = self.gmp.createReportCommand(self.REPORT_XML_STRING,
465
                                           {
466
                                               'task_id': self.TASK_ID,
467
                                           })
468
469
        self.assertEqual('<create_report><task id="' + self.TASK_ID + '"/>' +
470
                         self.REPORT_XML_STRING + '</create_report>',
471
                         cmd)
472
473
    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...
474
        cmd = self.gmp.createReportCommand(self.REPORT_XML_STRING,
475
                                           {
476
                                               'task_name': self.TASK_NAME,
477
                                               'comment': self.COMMENT,
478
                                           })
479
480
        self.assertEqual('<create_report><task>' +
481
                         '<name>' + self.TASK_NAME + '</name>' +
482
                         '<comment>' + self.COMMENT + '</comment>' +
483
                         '</task>' + self.REPORT_XML_STRING + '</create_report>',
484
                         cmd)
485
486
    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...
487
        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...
488
        args = {
489
            'task_name': self.TASK_NAME,
490
            'comment': self.COMMENT,
491
        }
492
493
        self.assertRaises(ValueError,
494
                          self.gmp.createReportCommand,
495
                          NO_REPORT,
496
                          args
497
        )
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 17 spaces).
Loading history...
498
499
    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...
500
        args = {'comment': self.COMMENT}
501
        self.assertRaises(ValueError,
502
                          self.gmp.createReportCommand,
503
                          self.REPORT_XML_STRING,
504
                          args
505
        )
0 ignored issues
show
Coding Style introduced by
Wrong continued indentation (add 17 spaces).
Loading history...
506
507
if __name__ == '__main__':
508
    unittest.main()
509