Beispiel #1
0
 def test_parse_threshold_native(self):
     plugin = Plugin()
     plugin.add_arg('-w', '--warning-threshold', type=Threshold)
     plugin.add_arg('-c', '--critical-threshold', type=Threshold)
     args = plugin.parse_args(['-w', '10:20', '-c', '0:40'])
     self.assertEqual(OK, plugin.check_threshold(15,
                                                 args.warning_threshold,
                                                 args.critical_threshold))
Beispiel #2
0
 def test_parse(self):
     plugin = Plugin()
     plugin.add_arg('-e', '--test', action='store_true')
     args = plugin.parser.parse_args(['-e'])
     self.assertTrue(args.test)
Beispiel #3
0
 def test_parse_exceptions(self):
     plugin = Plugin()
     plugin.add_arg('threshold', type=Threshold)
     self.assertRaises(ArgumentParserError, plugin.parse_args, [])