|
@@ 214-244 (lines=31) @@
|
| 211 |
|
ret = p.build_alive_test_opt_as_prefs(target_options_dict) |
| 212 |
|
self.assertEqual(ret, []) |
| 213 |
|
|
| 214 |
|
def test_build_alive_test_opt(self): |
| 215 |
|
w = DummyDaemon() |
| 216 |
|
|
| 217 |
|
alive_test_out = [ |
| 218 |
|
"1.3.6.1.4.1.25623.1.0.100315:1:checkbox:Do a TCP ping|||no", |
| 219 |
|
"1.3.6.1.4.1.25623.1.0.100315:2:checkbox:TCP ping tries also TCP-SYN ping|||no", |
| 220 |
|
"1.3.6.1.4.1.25623.1.0.100315:7:checkbox:TCP ping tries only TCP-SYN ping|||no", |
| 221 |
|
"1.3.6.1.4.1.25623.1.0.100315:3:checkbox:Do an ICMP ping|||yes", |
| 222 |
|
"1.3.6.1.4.1.25623.1.0.100315:4:checkbox:Use ARP|||no", |
| 223 |
|
"1.3.6.1.4.1.25623.1.0.100315:5:checkbox:Mark unrechable Hosts as dead (not scanning)|||yes", |
| 224 |
|
] |
| 225 |
|
target_options_dict = {'alive_test': '2'} |
| 226 |
|
p = PreferenceHandler('1234-1234', None, w.scan_collection, None) |
| 227 |
|
ret = p.build_alive_test_opt_as_prefs(target_options_dict) |
| 228 |
|
|
| 229 |
|
self.assertEqual(ret, alive_test_out) |
| 230 |
|
|
| 231 |
|
# alive test was supplied via sepertae xml element |
| 232 |
|
w = DummyDaemon() |
| 233 |
|
alive_test_out = [ |
| 234 |
|
"1.3.6.1.4.1.25623.1.0.100315:1:checkbox:Do a TCP ping|||no", |
| 235 |
|
"1.3.6.1.4.1.25623.1.0.100315:2:checkbox:TCP ping tries also TCP-SYN ping|||no", |
| 236 |
|
"1.3.6.1.4.1.25623.1.0.100315:7:checkbox:TCP ping tries only TCP-SYN ping|||no", |
| 237 |
|
"1.3.6.1.4.1.25623.1.0.100315:3:checkbox:Do an ICMP ping|||yes", |
| 238 |
|
"1.3.6.1.4.1.25623.1.0.100315:4:checkbox:Use ARP|||no", |
| 239 |
|
"1.3.6.1.4.1.25623.1.0.100315:5:checkbox:Mark unrechable Hosts as dead (not scanning)|||yes", |
| 240 |
|
] |
| 241 |
|
target_options_dict = {'alive_test_methods': '1', 'icmp': '1'} |
| 242 |
|
p = PreferenceHandler('1234-1234', None, w.scan_collection, None) |
| 243 |
|
ret = p.build_alive_test_opt_as_prefs(target_options_dict) |
| 244 |
|
self.assertEqual(ret, alive_test_out) |
| 245 |
|
|
| 246 |
|
def test_build_alive_test_opt_fail_1(self): |
| 247 |
|
w = DummyDaemon() |
|
@@ 197-212 (lines=16) @@
|
| 194 |
|
cred_out, |
| 195 |
|
) |
| 196 |
|
|
| 197 |
|
def test_build_alive_test_opt_empty(self): |
| 198 |
|
w = DummyDaemon() |
| 199 |
|
|
| 200 |
|
target_options_dict = {'alive_test': '0'} |
| 201 |
|
|
| 202 |
|
p = PreferenceHandler('1234-1234', None, w.scan_collection, None) |
| 203 |
|
ret = p.build_alive_test_opt_as_prefs(target_options_dict) |
| 204 |
|
|
| 205 |
|
self.assertEqual(ret, []) |
| 206 |
|
|
| 207 |
|
# alive test was supplied via seperate xml element |
| 208 |
|
w = DummyDaemon() |
| 209 |
|
target_options_dict = {'alive_test_methods': '1', 'icmp': '0'} |
| 210 |
|
p = PreferenceHandler('1234-1234', None, w.scan_collection, None) |
| 211 |
|
ret = p.build_alive_test_opt_as_prefs(target_options_dict) |
| 212 |
|
self.assertEqual(ret, []) |
| 213 |
|
|
| 214 |
|
def test_build_alive_test_opt(self): |
| 215 |
|
w = DummyDaemon() |