@@ 25-82 (lines=58) @@ | ||
22 | from gvm.protocols.gmpv214 import AlertMethod, get_alert_method_from_string |
|
23 | ||
24 | ||
25 | class GetAlertMethodFromStringTestCase(unittest.TestCase): |
|
26 | def test_invalid(self): |
|
27 | with self.assertRaises(InvalidArgument): |
|
28 | get_alert_method_from_string('foo') |
|
29 | ||
30 | def test_none_or_empty(self): |
|
31 | ct = get_alert_method_from_string(None) |
|
32 | self.assertIsNone(ct) |
|
33 | ct = get_alert_method_from_string('') |
|
34 | self.assertIsNone(ct) |
|
35 | ||
36 | def test_email(self): |
|
37 | ct = get_alert_method_from_string('email') |
|
38 | self.assertEqual(ct, AlertMethod.EMAIL) |
|
39 | ||
40 | def test_scp(self): |
|
41 | ct = get_alert_method_from_string('scp') |
|
42 | self.assertEqual(ct, AlertMethod.SCP) |
|
43 | ||
44 | def test_send(self): |
|
45 | ct = get_alert_method_from_string('send') |
|
46 | self.assertEqual(ct, AlertMethod.SEND) |
|
47 | ||
48 | def test_smb(self): |
|
49 | ct = get_alert_method_from_string('smb') |
|
50 | self.assertEqual(ct, AlertMethod.SMB) |
|
51 | ||
52 | def test_snmp(self): |
|
53 | ct = get_alert_method_from_string('snmp') |
|
54 | self.assertEqual(ct, AlertMethod.SNMP) |
|
55 | ||
56 | def test_syslog(self): |
|
57 | ct = get_alert_method_from_string('syslog') |
|
58 | self.assertEqual(ct, AlertMethod.SYSLOG) |
|
59 | ||
60 | def test_http_get(self): |
|
61 | ct = get_alert_method_from_string('HTTP Get') |
|
62 | self.assertEqual(ct, AlertMethod.HTTP_GET) |
|
63 | ||
64 | def test_start_task(self): |
|
65 | ct = get_alert_method_from_string('Start Task') |
|
66 | self.assertEqual(ct, AlertMethod.START_TASK) |
|
67 | ||
68 | def test_sourcefire_connector(self): |
|
69 | ct = get_alert_method_from_string('sourcefire Connector') |
|
70 | self.assertEqual(ct, AlertMethod.SOURCEFIRE_CONNECTOR) |
|
71 | ||
72 | def test_verinice_connector(self): |
|
73 | ct = get_alert_method_from_string('verinice Connector') |
|
74 | self.assertEqual(ct, AlertMethod.VERINICE_CONNECTOR) |
|
75 | ||
76 | def test_tippingpoint_sms(self): |
|
77 | ct = get_alert_method_from_string('Tippingpoint SMS') |
|
78 | self.assertEqual(ct, AlertMethod.TIPPINGPOINT_SMS) |
|
79 | ||
80 | def test_alemba_vfire(self): |
|
81 | ct = get_alert_method_from_string('Alemba vFire') |
|
82 | self.assertEqual(ct, AlertMethod.ALEMBA_VFIRE) |
|
83 | ||
84 | ||
85 | if __name__ == '__main__': |
@@ 25-82 (lines=58) @@ | ||
22 | from gvm.protocols.gmpv208 import AlertMethod, get_alert_method_from_string |
|
23 | ||
24 | ||
25 | class GetAlertMethodFromStringTestCase(unittest.TestCase): |
|
26 | def test_invalid(self): |
|
27 | with self.assertRaises(InvalidArgument): |
|
28 | get_alert_method_from_string('foo') |
|
29 | ||
30 | def test_none_or_empty(self): |
|
31 | ct = get_alert_method_from_string(None) |
|
32 | self.assertIsNone(ct) |
|
33 | ct = get_alert_method_from_string('') |
|
34 | self.assertIsNone(ct) |
|
35 | ||
36 | def test_email(self): |
|
37 | ct = get_alert_method_from_string('email') |
|
38 | self.assertEqual(ct, AlertMethod.EMAIL) |
|
39 | ||
40 | def test_scp(self): |
|
41 | ct = get_alert_method_from_string('scp') |
|
42 | self.assertEqual(ct, AlertMethod.SCP) |
|
43 | ||
44 | def test_send(self): |
|
45 | ct = get_alert_method_from_string('send') |
|
46 | self.assertEqual(ct, AlertMethod.SEND) |
|
47 | ||
48 | def test_smb(self): |
|
49 | ct = get_alert_method_from_string('smb') |
|
50 | self.assertEqual(ct, AlertMethod.SMB) |
|
51 | ||
52 | def test_snmp(self): |
|
53 | ct = get_alert_method_from_string('snmp') |
|
54 | self.assertEqual(ct, AlertMethod.SNMP) |
|
55 | ||
56 | def test_syslog(self): |
|
57 | ct = get_alert_method_from_string('syslog') |
|
58 | self.assertEqual(ct, AlertMethod.SYSLOG) |
|
59 | ||
60 | def test_http_get(self): |
|
61 | ct = get_alert_method_from_string('HTTP Get') |
|
62 | self.assertEqual(ct, AlertMethod.HTTP_GET) |
|
63 | ||
64 | def test_start_task(self): |
|
65 | ct = get_alert_method_from_string('Start Task') |
|
66 | self.assertEqual(ct, AlertMethod.START_TASK) |
|
67 | ||
68 | def test_sourcefire_connector(self): |
|
69 | ct = get_alert_method_from_string('sourcefire Connector') |
|
70 | self.assertEqual(ct, AlertMethod.SOURCEFIRE_CONNECTOR) |
|
71 | ||
72 | def test_verinice_connector(self): |
|
73 | ct = get_alert_method_from_string('verinice Connector') |
|
74 | self.assertEqual(ct, AlertMethod.VERINICE_CONNECTOR) |
|
75 | ||
76 | def test_tippingpoint_sms(self): |
|
77 | ct = get_alert_method_from_string('Tippingpoint SMS') |
|
78 | self.assertEqual(ct, AlertMethod.TIPPINGPOINT_SMS) |
|
79 | ||
80 | def test_alemba_vfire(self): |
|
81 | ct = get_alert_method_from_string('Alemba vFire') |
|
82 | self.assertEqual(ct, AlertMethod.ALEMBA_VFIRE) |
|
83 | ||
84 | ||
85 | if __name__ == '__main__': |