|
@@ 226-241 (lines=16) @@
|
| 223 |
|
self.assertEqual('<modification_time>19000202</modification_time>', |
| 224 |
|
ET.tostring(modification_time[0]).decode('utf-8')) |
| 225 |
|
|
| 226 |
|
def testGetVTs_filter_negative(self): |
| 227 |
|
daemon = DummyWrapper([]) |
| 228 |
|
daemon.add_vt('1.2.3.4', |
| 229 |
|
'A vulnerability test', |
| 230 |
|
vt_params="a", |
| 231 |
|
vt_modification_time='19000202') |
| 232 |
|
response = secET.fromstring( |
| 233 |
|
daemon.handle_command('<get_vts filter="modification_time<19000203"></get_vts>')) |
| 234 |
|
self.assertEqual(response.get('status'), '200') |
| 235 |
|
vts = response.find('vts') |
| 236 |
|
self.assertIsNotNone(vts.find('vt')) |
| 237 |
|
vt = vts.find('vt') |
| 238 |
|
self.assertEqual(vt.get('id'), '1.2.3.4') |
| 239 |
|
modification_time = response.findall('vts/vt/modification_time') |
| 240 |
|
self.assertEqual('<modification_time>19000202</modification_time>', |
| 241 |
|
ET.tostring(modification_time[0]).decode('utf-8')) |
| 242 |
|
|
| 243 |
|
def testGetVTs_multiple_VTs(self): |
| 244 |
|
daemon = DummyWrapper([]) |
|
@@ 209-224 (lines=16) @@
|
| 206 |
|
vt = vts.find('vt') |
| 207 |
|
self.assertEqual(vt.get('id'), '1.2.3.4') |
| 208 |
|
|
| 209 |
|
def testGetVTs_filter_positive(self): |
| 210 |
|
daemon = DummyWrapper([]) |
| 211 |
|
daemon.add_vt('1.2.3.4', |
| 212 |
|
'A vulnerability test', |
| 213 |
|
vt_params="a", |
| 214 |
|
vt_modification_time='19000202') |
| 215 |
|
response = secET.fromstring( |
| 216 |
|
daemon.handle_command('<get_vts filter="modification_time>19000201"></get_vts>')) |
| 217 |
|
self.assertEqual(response.get('status'), '200') |
| 218 |
|
vts = response.find('vts') |
| 219 |
|
self.assertIsNotNone(vts.find('vt')) |
| 220 |
|
vt = vts.find('vt') |
| 221 |
|
self.assertEqual(vt.get('id'), '1.2.3.4') |
| 222 |
|
modification_time = response.findall('vts/vt/modification_time') |
| 223 |
|
self.assertEqual('<modification_time>19000202</modification_time>', |
| 224 |
|
ET.tostring(modification_time[0]).decode('utf-8')) |
| 225 |
|
|
| 226 |
|
def testGetVTs_filter_negative(self): |
| 227 |
|
daemon = DummyWrapper([]) |