@@ 232-256 (lines=25) @@ | ||
229 | ET.tostring(modification_time[0]).decode('utf-8'), |
|
230 | ) |
|
231 | ||
232 | def test_get_vts_filter_negative(self): |
|
233 | self.daemon.add_vt( |
|
234 | '1.2.3.4', |
|
235 | 'A vulnerability test', |
|
236 | vt_params="a", |
|
237 | vt_modification_time='19000202', |
|
238 | ) |
|
239 | fs = FakeStream() |
|
240 | self.daemon.handle_command( |
|
241 | '<get_vts filter="modification_time<19000203"></get_vts>', |
|
242 | fs, |
|
243 | ) |
|
244 | response = fs.get_response() |
|
245 | ||
246 | self.assertEqual(response.get('status'), '200') |
|
247 | ||
248 | vts = response.find('vts') |
|
249 | ||
250 | vt = vts.find('vt') |
|
251 | self.assertIsNotNone(vt) |
|
252 | self.assertEqual(vt.get('id'), '1.2.3.4') |
|
253 | ||
254 | modification_time = response.findall('vts/vt/modification_time') |
|
255 | self.assertEqual( |
|
256 | '<modification_time>19000202</modification_time>', |
|
257 | ET.tostring(modification_time[0]).decode('utf-8'), |
|
258 | ) |
|
259 | ||
@@ 205-229 (lines=25) @@ | ||
202 | ||
203 | self.assertEqual(response.get('status'), '200') |
|
204 | ||
205 | def test_get_vts_filter_positive(self): |
|
206 | self.daemon.add_vt( |
|
207 | '1.2.3.4', |
|
208 | 'A vulnerability test', |
|
209 | vt_params="a", |
|
210 | vt_modification_time='19000202', |
|
211 | ) |
|
212 | fs = FakeStream() |
|
213 | ||
214 | self.daemon.handle_command( |
|
215 | '<get_vts filter="modification_time>19000201"></get_vts>', fs |
|
216 | ) |
|
217 | response = fs.get_response() |
|
218 | ||
219 | self.assertEqual(response.get('status'), '200') |
|
220 | vts = response.find('vts') |
|
221 | ||
222 | vt = vts.find('vt') |
|
223 | self.assertIsNotNone(vt) |
|
224 | self.assertEqual(vt.get('id'), '1.2.3.4') |
|
225 | ||
226 | modification_time = response.findall('vts/vt/modification_time') |
|
227 | self.assertEqual( |
|
228 | '<modification_time>19000202</modification_time>', |
|
229 | ET.tostring(modification_time[0]).decode('utf-8'), |
|
230 | ) |
|
231 | ||
232 | def test_get_vts_filter_negative(self): |