|
@@ 283-303 (lines=21) @@
|
| 280 |
|
params = response.findall('vts/vt/vt_params/vt_param') |
| 281 |
|
self.assertEqual(2, len(params)) |
| 282 |
|
|
| 283 |
|
def testGetVTs_VTs_with_refs(self): |
| 284 |
|
daemon = DummyWrapper([]) |
| 285 |
|
daemon.add_vt('1.2.3.4', |
| 286 |
|
'A vulnerability test', |
| 287 |
|
vt_params="a", |
| 288 |
|
custom="b", |
| 289 |
|
vt_refs="c") |
| 290 |
|
response = secET.fromstring( |
| 291 |
|
daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>')) |
| 292 |
|
# The status of the response must be success (i.e. 200) |
| 293 |
|
self.assertEqual(response.get('status'), '200') |
| 294 |
|
# The response root element must have the correct name |
| 295 |
|
self.assertEqual(response.tag, 'get_vts_response') |
| 296 |
|
# The response must contain a 'vts' element |
| 297 |
|
self.assertIsNotNone(response.find('vts')) |
| 298 |
|
vt_params = response[0][0].findall('vt_params') |
| 299 |
|
self.assertEqual(1, len(vt_params)) |
| 300 |
|
custom = response[0][0].findall('custom') |
| 301 |
|
self.assertEqual(1, len(custom)) |
| 302 |
|
refs = response.findall('vts/vt/refs/ref') |
| 303 |
|
self.assertEqual(2, len(refs)) |
| 304 |
|
|
| 305 |
|
def testGetVTs_VTs_with_dependencies(self): |
| 306 |
|
daemon = DummyWrapper([]) |
|
@@ 264-279 (lines=16) @@
|
| 261 |
|
custom = response.findall('vts/vt/custom') |
| 262 |
|
self.assertEqual(3, len(custom)) |
| 263 |
|
|
| 264 |
|
def testGetVTs_VTs_with_params(self): |
| 265 |
|
daemon = DummyWrapper([]) |
| 266 |
|
daemon.add_vt('1.2.3.4', 'A vulnerability test', |
| 267 |
|
vt_params="a", custom="b") |
| 268 |
|
response = secET.fromstring( |
| 269 |
|
daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>')) |
| 270 |
|
# The status of the response must be success (i.e. 200) |
| 271 |
|
self.assertEqual(response.get('status'), '200') |
| 272 |
|
# The response root element must have the correct name |
| 273 |
|
self.assertEqual(response.tag, 'get_vts_response') |
| 274 |
|
# The response must contain a 'scanner_params' element |
| 275 |
|
self.assertIsNotNone(response.find('vts')) |
| 276 |
|
vt_params = response[0][0].findall('vt_params') |
| 277 |
|
self.assertEqual(1, len(vt_params)) |
| 278 |
|
custom = response[0][0].findall('custom') |
| 279 |
|
self.assertEqual(1, len(custom)) |
| 280 |
|
params = response.findall('vts/vt/vt_params/vt_param') |
| 281 |
|
self.assertEqual(2, len(params)) |
| 282 |
|
|