@@ 25-42 (lines=18) @@ | ||
22 | from gvm.protocols.gmpv214 import SortOrder, get_sort_order_from_string |
|
23 | ||
24 | ||
25 | class GetSortOrderFromStringTestCase(unittest.TestCase): |
|
26 | def test_invalid(self): |
|
27 | with self.assertRaises(InvalidArgument): |
|
28 | get_sort_order_from_string('foo') |
|
29 | ||
30 | def test_none_or_empty(self): |
|
31 | ct = get_sort_order_from_string(None) |
|
32 | self.assertIsNone(ct) |
|
33 | ct = get_sort_order_from_string('') |
|
34 | self.assertIsNone(ct) |
|
35 | ||
36 | def test_ascending(self): |
|
37 | ct = get_sort_order_from_string('ascending') |
|
38 | self.assertEqual(ct, SortOrder.ASCENDING) |
|
39 | ||
40 | def test_descending(self): |
|
41 | ct = get_sort_order_from_string('descending') |
|
42 | self.assertEqual(ct, SortOrder.DESCENDING) |
|
43 | ||
44 | ||
45 | if __name__ == '__main__': |
@@ 25-42 (lines=18) @@ | ||
22 | from gvm.protocols.gmpv208 import SortOrder, get_sort_order_from_string |
|
23 | ||
24 | ||
25 | class GetSortOrderFromStringTestCase(unittest.TestCase): |
|
26 | def test_invalid(self): |
|
27 | with self.assertRaises(InvalidArgument): |
|
28 | get_sort_order_from_string('foo') |
|
29 | ||
30 | def test_none_or_empty(self): |
|
31 | ct = get_sort_order_from_string(None) |
|
32 | self.assertIsNone(ct) |
|
33 | ct = get_sort_order_from_string('') |
|
34 | self.assertIsNone(ct) |
|
35 | ||
36 | def test_ascending(self): |
|
37 | ct = get_sort_order_from_string('ascending') |
|
38 | self.assertEqual(ct, SortOrder.ASCENDING) |
|
39 | ||
40 | def test_descending(self): |
|
41 | ct = get_sort_order_from_string('descending') |
|
42 | self.assertEqual(ct, SortOrder.DESCENDING) |
|
43 | ||
44 | ||
45 | if __name__ == '__main__': |