Completed
Push — master ( a8c94d...6cf829 )
by
unknown
13s queued 10s
created

FullTest.testBillonLaughs()   A

Complexity

Conditions 1

Size

Total Lines 17
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 17
nop 1
dl 0
loc 17
rs 9.55
c 0
b 0
f 0
1
from __future__ import print_function
0 ignored issues
show
Coding Style Naming introduced by
The name testScanAndResult does not conform to the module naming conventions ((([a-z_][a-z0-9_]*)|([A-Z][a-zA-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 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
3
4
import time
5
import unittest
6
import xml.etree.ElementTree as ET
7
import defusedxml.lxml as secET
8
from defusedxml.common import EntitiesForbidden
9
10
from ospd.ospd import OSPDaemon, OSPDError
11
12
13
class Result(object):
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...
best-practice introduced by
Too many instance attributes (8/7)
Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
14
    def __init__(self, type_, **kwargs):
15
        self.result_type = type_
16
        self.host = ''
17
        self.name = ''
18
        self.value = ''
19
        self.port = ''
20
        self.test_id = ''
21
        self.severity = ''
22
        self.qod = ''
23
        for name, value in kwargs.items():
24
            setattr(self, name, value)
25
26
27
class DummyWrapper(OSPDaemon):
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
    def __init__(self, results, checkresult=True):
29
        OSPDaemon.__init__(self, 'cert', 'key', 'ca')
30
        self.checkresult = checkresult
31
        self.results = results
32
33
    def check(self):
34
        return self.checkresults
0 ignored issues
show
Bug introduced by
Instance of 'DummyWrapper' has no 'checkresults' member; maybe 'checkresult'?

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
35
36
    def get_custom_vt_as_xml_str(self, custom):
37
        return '<mytest>static test</mytest>'
38
39
    def get_params_vt_as_xml_str(self, vt_param):
0 ignored issues
show
Bug introduced by
Parameters differ from overridden 'get_params_vt_as_xml_str' method
Loading history...
Unused Code introduced by
The argument vt_param seems to be unused.
Loading history...
40
        return ('<vt_param id="abc" type="string">'
41
                '<name>ABC</name><description>Test ABC</description><default>yes</default>'
42
                '</vt_param>'
43
                '<vt_param id="def" type="string">'
44
                '<name>DEF</name><description>Test DEF</description><default>no</default>'
45
                '</vt_param>')
46
47
    def exec_scan(self, scan_id, target):
48
        time.sleep(0.01)
49
        for res in self.results:
50
            if res.result_type == 'log':
51
                self.add_scan_log(scan_id, res.host or target, res.name, res.value, res.port)
52
            if res.result_type == 'error':
53
                self.add_scan_error(scan_id, res.host or target, res.name, res.value, res.port)
54
            elif res.result_type == 'host-detail':
55
                self.add_scan_error(scan_id, res.host or target, res.name, res.value)
56
            elif res.result_type == 'alarm':
57
                self.add_scan_alarm(scan_id, res.host or target, res.name, res.value, res.port, res.test_id, res.severity, res.qod)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (131/100).

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

Loading history...
58
            else:
59
                raise ValueError(res.result_type)
60
61
62
class FullTest(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...
63
    # TODO: There should be a lot more assert in there !
0 ignored issues
show
Coding Style introduced by
TODO and FIXME comments should generally be avoided.
Loading history...
64
65
    def testGetDefaultScannerParams(self):
0 ignored issues
show
Coding Style Naming introduced by
The name testGetDefaultScannerParams 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...
66
        daemon = DummyWrapper([])
67
        response = secET.fromstring(daemon.handle_command('<get_scanner_details />'))
68
        # The status of the response must be success (i.e. 200)
69
        self.assertEqual(response.get('status'), '200')
70
        # The response root element must have the correct name
71
        self.assertEqual(response.tag, 'get_scanner_details_response')
72
        # The response must contain a 'scanner_params' element
73
        self.assertIsNotNone(response.find('scanner_params'))
74
75
    def testGetDefaultHelp(self):
0 ignored issues
show
Coding Style Naming introduced by
The name testGetDefaultHelp 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...
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
76
        daemon = DummyWrapper([])
77
        response = secET.fromstring(daemon.handle_command('<help />'))
78
        print(ET.tostring(response))
79
        response = secET.fromstring(daemon.handle_command('<help format="xml" />'))
80
        print(ET.tostring(response))
81
82
    def testGetDefaultScannerVersion(self):
0 ignored issues
show
Coding Style Naming introduced by
The name testGetDefaultScannerVersion 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...
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
83
        daemon = DummyWrapper([])
84
        response = secET.fromstring(daemon.handle_command('<get_version />'))
85
        print(ET.tostring(response))
86
87
    def testGetVTs_no_VT(self):
0 ignored issues
show
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...
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
Coding Style Naming introduced by
The name testGetVTs_no_VT 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...
88
        daemon = DummyWrapper([])
89
        response = secET.fromstring(daemon.handle_command('<get_vts />'))
90
        print(ET.tostring(response))
91
92
    def testGetVTs_single_VT(self):
0 ignored issues
show
Coding Style Naming introduced by
The name testGetVTs_single_VT 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...
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
93
        daemon = DummyWrapper([])
94
        daemon.add_vt('1.2.3.4', 'A vulnerability test')
95
        response = secET.fromstring(daemon.handle_command('<get_vts />'))
96
        print(ET.tostring(response))
97
98
    def testGetVTs_multiple_VTs(self):
0 ignored issues
show
Coding Style Naming introduced by
The name testGetVTs_multiple_VTs 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...
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
99
        daemon = DummyWrapper([])
100
        daemon.add_vt('1.2.3.4', 'A vulnerability test')
101
        daemon.add_vt('some id', 'Another vulnerability test')
102
        daemon.add_vt('123456789', 'Yet another vulnerability test')
103
        response = secET.fromstring(daemon.handle_command('<get_vts />'))
104
        print(ET.tostring(response))
105
106
    def testGetVTs_multiple_VTs_with_custom(self):
0 ignored issues
show
Coding Style Naming introduced by
The name testGetVTs_multiple_VTs_with_custom 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...
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
107
        daemon = DummyWrapper([])
108
        daemon.add_vt('1.2.3.4', 'A vulnerability test')
109
        daemon.add_vt('some id', 'Another vulnerability test with custom info', {'depencency': '1.2.3.4'})
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (106/100).

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

Loading history...
110
        daemon.add_vt('123456789', 'Yet another vulnerability test')
111
        response = secET.fromstring(daemon.handle_command('<get_vts />'))
112
        print(ET.tostring(response))
113
114
    def testGetVTs_VTs_with_params(self):
0 ignored issues
show
Coding Style Naming introduced by
The name testGetVTs_VTs_with_params 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
        daemon = DummyWrapper([])
116
        daemon.add_vt('1.2.3.4', 'A vulnerability test', vt_params="a", custom="b")
117
        response = secET.fromstring(daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>'))
118
        print(ET.tostring(response))
119
        # The status of the response must be success (i.e. 200)
120
        self.assertEqual(response.get('status'), '200')
121
        # The response root element must have the correct name
122
        self.assertEqual(response.tag, 'get_vts_response')
123
        # The response must contain a 'scanner_params' element
124
        self.assertIsNotNone(response.find('vts'))
125
        vt_params = response[0][0].findall('vt_params')
126
        self.assertEqual(1, len(vt_params))
127
        custom = response[0][0].findall('custom')
128
        self.assertEqual(1, len(custom))
129
        params = response.findall('vts/vt/vt_params/vt_param')
130
        self.assertEqual(2, len(params))
131
132
    def testiScanWithError(self):
0 ignored issues
show
Coding Style Naming introduced by
The name testiScanWithError 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
        daemon = DummyWrapper([
134
            Result('error', value='something went wrong'),
135
        ])
136
137
        response = secET.fromstring(daemon.handle_command('<start_scan target="localhost" ports="80, 443"><scanner_params /></start_scan>'))
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (140/100).

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

Loading history...
138
        print(ET.tostring(response))
139
        scan_id = response.findtext('id')
140
        finished = False
141
        while not finished:
142
            response = secET.fromstring(daemon.handle_command('<get_scans scan_id="%s" details="0"/>' % scan_id))
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (113/100).

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

Loading history...
143
            print(ET.tostring(response))
144
            scans = response.findall('scan')
145
            self.assertEqual(1, len(scans))
146
            scan = scans[0]
147
            if int(scan.get('progress')) != 100:
148
                self.assertEqual('0', scan.get('end_time'))
149
                time.sleep(.010)
150
            else:
151
                finished = True
152
        response = secET.fromstring(daemon.handle_command('<get_scans scan_id="%s"/>' % scan_id))
153
        print(ET.tostring(response))
154
        response = secET.fromstring(daemon.handle_command('<get_scans />'))
155
        print(ET.tostring(response))
156
        response = secET.fromstring(daemon.handle_command('<get_scans scan_id="%s" details="1"/>' % scan_id))
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (109/100).

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

Loading history...
157
        self.assertEqual(response.findtext('scan/results/result'), 'something went wrong')
158
        print(ET.tostring(response))
159
160
        response = secET.fromstring(daemon.handle_command('<delete_scan scan_id="%s" />' % scan_id))
161
        self.assertEqual(response.get('status'), '200')
162
        print(ET.tostring(response))
163
164
    def testStopScan(self):
0 ignored issues
show
Coding Style Naming introduced by
The name testStopScan 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...
165
        daemon = DummyWrapper([])
166
        response = secET.fromstring(
167
            daemon.handle_command('<start_scan ' +
168
                                  'target="localhost" ports="80, 443">' +
169
                                  '<scanner_params /></start_scan>'))
170
        print(ET.tostring(response))
171
        scan_id = response.findtext('id')
172
        time.sleep(0.01)
173
174
        response = daemon.stop_scan(scan_id)
175
        self.assertEqual(response, None)
176
177
        response = secET.fromstring(daemon.handle_command(
178
            '<stop_scan scan_id="%s" />' % scan_id))
179
        self.assertEqual(response.get('status'), '200')
180
        print(ET.tostring(response))
181
182
    def testScanWithVTs(self):
0 ignored issues
show
Coding Style Naming introduced by
The name testScanWithVTs 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...
183
        daemon = DummyWrapper([])
184
        cmd = secET.fromstring('<start_scan ' +
185
                               'target="localhost" ports="80, 443">' +
186
                               '<scanner_params /><vts /></start_scan>')
187
        print(ET.tostring(cmd))
188
        self.assertRaises(OSPDError, daemon.handle_start_scan_command, cmd)
189
190
        # With one VT, without params
191
        response = secET.fromstring(
192
            daemon.handle_command('<start_scan ' +
193
                                  'target="localhost" ports="80, 443">' +
194
                                  '<scanner_params /><vts><vt id="1.2.3.4" />' +
195
                                  '</vts></start_scan>'))
196
        print(ET.tostring(response))
197
        scan_id = response.findtext('id')
198
        time.sleep(0.01)
199
        self.assertEqual(daemon.get_scan_vts(scan_id), {'1.2.3.4': {}})
200
        self.assertNotEqual(daemon.get_scan_vts(scan_id), {'1.2.3.6': {}})
201
202
        # With out VTS
203
        response = secET.fromstring(
204
            daemon.handle_command('<start_scan ' +
205
                                  'target="localhost" ports="80, 443">' +
206
                                  '<scanner_params /></start_scan>'))
207
        print(ET.tostring(response))
208
        scan_id = response.findtext('id')
209
        time.sleep(0.01)
210
        self.assertEqual(daemon.get_scan_vts(scan_id), {})
211
212
    def testScanWithVTs_and_param(self):
0 ignored issues
show
Coding Style Naming introduced by
The name testScanWithVTs_and_param 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...
213
        daemon = DummyWrapper([])
214
215
        # Raise because no vt_param name attribute
216
        cmd = secET.fromstring('<start_scan ' +
217
                               'target="localhost" ports="80, 443">' +
218
                               '<scanner_params /><vts><vt id="1234">' +
219
                               '<vt_param type="entry">200</vt_param>' +
220
                               '</vt></vts></start_scan>')
221
        print(ET.tostring(cmd))
222
        self.assertRaises(OSPDError, daemon.handle_start_scan_command, cmd)
223
224
        # No error
225
        response = secET.fromstring(
226
            daemon.handle_command('<start_scan ' +
227
                                  'target="localhost" ports="80, 443">' +
228
                                  '<scanner_params /><vts><vt id="1234">' +
229
                                  '<vt_param name="ABC" type="entry">200' +
230
                                  '</vt_param></vt></vts></start_scan>'))
231
        print(ET.tostring(response))
232
        scan_id = response.findtext('id')
233
        time.sleep(0.01)
234
        self.assertEqual(daemon.get_scan_vts(scan_id),
235
                         {'1234': {'ABC': {'type': 'entry', 'value': '200'}}})
236
237
    def testBillonLaughs(self):
0 ignored issues
show
Coding Style Naming introduced by
The name testBillonLaughs 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...
238
        daemon = DummyWrapper([])
239
        lol = ('<?xml version="1.0"?>' +
240
               '<!DOCTYPE lolz [' +
241
               ' <!ENTITY lol "lol">' +
242
               ' <!ELEMENT lolz (#PCDATA)>' +
243
               ' <!ENTITY lol1 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;">' +
244
               ' <!ENTITY lol2 "&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;">' +
245
               ' <!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;">' +
246
               ' <!ENTITY lol4 "&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;">' +
247
               ' <!ENTITY lol5 "&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;">' +
248
               ' <!ENTITY lol6 "&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;">' +
249
               ' <!ENTITY lol7 "&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;">' +
250
               ' <!ENTITY lol8 "&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;">' +
251
               ' <!ENTITY lol9 "&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;">' +
252
               ']>')
253
        self.assertRaises(EntitiesForbidden, daemon.handle_command, lol)
254