| @@ 25-50 (lines=26) @@ | ||
| 22 | from gvm.protocols.gmpv214 import HelpFormat, get_help_format_from_string |
|
| 23 | ||
| 24 | ||
| 25 | class GetHelpFormatFromStringTestCase(unittest.TestCase): |
|
| 26 | def test_invalid(self): |
|
| 27 | with self.assertRaises(InvalidArgument): |
|
| 28 | get_help_format_from_string('foo') |
|
| 29 | ||
| 30 | def test_none_or_empty(self): |
|
| 31 | ct = get_help_format_from_string(None) |
|
| 32 | self.assertIsNone(ct) |
|
| 33 | ct = get_help_format_from_string('') |
|
| 34 | self.assertIsNone(ct) |
|
| 35 | ||
| 36 | def test_task_run_status_changed(self): |
|
| 37 | ct = get_help_format_from_string('HtMl') |
|
| 38 | self.assertEqual(ct, HelpFormat.HTML) |
|
| 39 | ||
| 40 | def test_new_secinfo_arrived(self): |
|
| 41 | ct = get_help_format_from_string('rNc') |
|
| 42 | self.assertEqual(ct, HelpFormat.RNC) |
|
| 43 | ||
| 44 | def test_updated_secinfo_arrived(self): |
|
| 45 | ct = get_help_format_from_string('tExT') |
|
| 46 | self.assertEqual(ct, HelpFormat.TEXT) |
|
| 47 | ||
| 48 | def test_ticket_received(self): |
|
| 49 | ct = get_help_format_from_string('XmL') |
|
| 50 | self.assertEqual(ct, HelpFormat.XML) |
|
| 51 | ||
| 52 | ||
| 53 | if __name__ == '__main__': |
|
| @@ 25-50 (lines=26) @@ | ||
| 22 | from gvm.protocols.gmpv208 import HelpFormat, get_help_format_from_string |
|
| 23 | ||
| 24 | ||
| 25 | class GetHelpFormatFromStringTestCase(unittest.TestCase): |
|
| 26 | def test_invalid(self): |
|
| 27 | with self.assertRaises(InvalidArgument): |
|
| 28 | get_help_format_from_string('foo') |
|
| 29 | ||
| 30 | def test_none_or_empty(self): |
|
| 31 | ct = get_help_format_from_string(None) |
|
| 32 | self.assertIsNone(ct) |
|
| 33 | ct = get_help_format_from_string('') |
|
| 34 | self.assertIsNone(ct) |
|
| 35 | ||
| 36 | def test_task_run_status_changed(self): |
|
| 37 | ct = get_help_format_from_string('HtMl') |
|
| 38 | self.assertEqual(ct, HelpFormat.HTML) |
|
| 39 | ||
| 40 | def test_new_secinfo_arrived(self): |
|
| 41 | ct = get_help_format_from_string('rNc') |
|
| 42 | self.assertEqual(ct, HelpFormat.RNC) |
|
| 43 | ||
| 44 | def test_updated_secinfo_arrived(self): |
|
| 45 | ct = get_help_format_from_string('tExT') |
|
| 46 | self.assertEqual(ct, HelpFormat.TEXT) |
|
| 47 | ||
| 48 | def test_ticket_received(self): |
|
| 49 | ct = get_help_format_from_string('XmL') |
|
| 50 | self.assertEqual(ct, HelpFormat.XML) |
|
| 51 | ||
| 52 | ||
| 53 | if __name__ == '__main__': |
|