| @@ 187-212 (lines=26) @@ | ||
| 184 | ET.tostring(modification_time[0]).decode('utf-8'), |
|
| 185 | ) |
|
| 186 | ||
| 187 | def test_get_vts_filter_negative(self): |
|
| 188 | daemon = DummyWrapper([]) |
|
| 189 | daemon.add_vt( |
|
| 190 | '1.2.3.4', |
|
| 191 | 'A vulnerability test', |
|
| 192 | vt_params="a", |
|
| 193 | vt_modification_time='19000202', |
|
| 194 | ) |
|
| 195 | fs = FakeStream() |
|
| 196 | daemon.handle_command( |
|
| 197 | '<get_vts filter="modification_time<19000203"></get_vts>', fs, |
|
| 198 | ) |
|
| 199 | response = fs.get_response() |
|
| 200 | ||
| 201 | self.assertEqual(response.get('status'), '200') |
|
| 202 | ||
| 203 | vts = response.find('vts') |
|
| 204 | ||
| 205 | vt = vts.find('vt') |
|
| 206 | self.assertIsNotNone(vt) |
|
| 207 | self.assertEqual(vt.get('id'), '1.2.3.4') |
|
| 208 | ||
| 209 | modification_time = response.findall('vts/vt/modification_time') |
|
| 210 | self.assertEqual( |
|
| 211 | '<modification_time>19000202</modification_time>', |
|
| 212 | ET.tostring(modification_time[0]).decode('utf-8'), |
|
| 213 | ) |
|
| 214 | ||
| 215 | def test_get_vtss_multiple_vts(self): |
|
| @@ 159-184 (lines=26) @@ | ||
| 156 | ||
| 157 | self.assertEqual(response.get('status'), '200') |
|
| 158 | ||
| 159 | def test_get_vts_filter_positive(self): |
|
| 160 | daemon = DummyWrapper([]) |
|
| 161 | daemon.add_vt( |
|
| 162 | '1.2.3.4', |
|
| 163 | 'A vulnerability test', |
|
| 164 | vt_params="a", |
|
| 165 | vt_modification_time='19000202', |
|
| 166 | ) |
|
| 167 | fs = FakeStream() |
|
| 168 | ||
| 169 | daemon.handle_command( |
|
| 170 | '<get_vts filter="modification_time>19000201"></get_vts>', fs |
|
| 171 | ) |
|
| 172 | response = fs.get_response() |
|
| 173 | ||
| 174 | self.assertEqual(response.get('status'), '200') |
|
| 175 | vts = response.find('vts') |
|
| 176 | ||
| 177 | vt = vts.find('vt') |
|
| 178 | self.assertIsNotNone(vt) |
|
| 179 | self.assertEqual(vt.get('id'), '1.2.3.4') |
|
| 180 | ||
| 181 | modification_time = response.findall('vts/vt/modification_time') |
|
| 182 | self.assertEqual( |
|
| 183 | '<modification_time>19000202</modification_time>', |
|
| 184 | ET.tostring(modification_time[0]).decode('utf-8'), |
|
| 185 | ) |
|
| 186 | ||
| 187 | def test_get_vts_filter_negative(self): |
|