Example #1
0
 def test_config_file_missing_from_commandline(self, SysExitMock):
     sys.argv = [
         './check_cert',
     ]
     # Suppres warnings from argparse
     with mock.patch('sys.stderr'):
         check_cert.parse_command_line()
     SysExitMock.assert_called_once_with(2)
Example #2
0
 def test_default_command_line_args(self, *unused):
     # Test default values:
     sys.argv = ['./check_cert', '-c', './check_cert.json']
     parsed_cmdline = check_cert.parse_command_line()
     self.assertEqual(parsed_cmdline, {'std_err': False,
                                       'config_file': './check_cert.json',
                                       'verbose': False,
                                       'dont_send': False,
                                       })
Example #3
0
 def test_proper_command_line_parsing(self, *unused):
     # General parsing:
     sys.argv = ['./check_cert', '-v', '-s', '-d', '-c', './check_cert.json']
     parsed_cmdline = check_cert.parse_command_line()
     self.assertEqual(parsed_cmdline, {'std_err': True,
                                       'config_file': './check_cert.json',
                                       'verbose': True,
                                       'dont_send': True,
                                       })
Example #4
0
 def test_default_command_line_args(self, *unused):
     # Test default values:
     sys.argv = ['./check_cert', '-c', './check_cert.json']
     parsed_cmdline = check_cert.parse_command_line()
     self.assertEqual(
         parsed_cmdline, {
             'std_err': False,
             'config_file': './check_cert.json',
             'verbose': False,
             'dont_send': False,
         })
Example #5
0
 def test_proper_command_line_parsing(self, *unused):
     # General parsing:
     sys.argv = [
         './check_cert', '-v', '-s', '-d', '-c', './check_cert.json'
     ]
     parsed_cmdline = check_cert.parse_command_line()
     self.assertEqual(
         parsed_cmdline, {
             'std_err': True,
             'config_file': './check_cert.json',
             'verbose': True,
             'dont_send': True,
         })
Example #6
0
 def test_config_file_missing_from_commandline(self, SysExitMock):
     sys.argv = ['./check_cert', ]
     # Suppres warnings from argparse
     with mock.patch('sys.stderr'):
         check_cert.parse_command_line()
     SysExitMock.assert_called_once_with(2)