示例#1
0
 def test_correct_quiet_value(self, misfile):
     # quiet can be set to True using -q (it is False by default).
     # This sets log_level to logging.WARNING.
     misfile.return_value = True
     parameters = parse_parameters([self.config_file, '-q'])
     misfile.assert_called_once_with(parameters.config_file)
     reference = logging.WARNING
     self.assertEquals(parameters.log_level, reference)
示例#2
0
 def test_correct_verbose_value(self, misfile):
     # verbose can be set to True using --verbose (it is False
     # by default). This sets log_level to logging.DEBUG.
     misfile.return_value = True
     parameters = parse_parameters([self.config_file, '--verbose'])
     misfile.assert_called_once_with(parameters.config_file)
     reference = logging.DEBUG
     self.assertEquals(parameters.log_level, reference)
示例#3
0
 def test_correct_log_name_value(self, misfile):
     # log_name can be set using --log_name.
     misfile.return_value = True
     reference = 'my_log.txt'
     parameters = parse_parameters(
         [self.config_file, '--log_name', reference])
     misfile.assert_called_once_with(parameters.config_file)
     self.assertEquals(parameters.log_name, reference)
示例#4
0
 def test_correct_append_log_value(self, misfile):
     # append_log can be set to True using -a (it is False by
     # default).
     misfile.return_value = True
     parameters = parse_parameters([self.config_file, '-a'])
     misfile.assert_called_once_with(parameters.config_file)
     reference = True
     self.assertEquals(parameters.append_log, reference)
示例#5
0
 def test_correct_argparse_namespace(self, misfile):
     misfile.return_value = True
     parameters = parse_parameters([self.config_file])
     misfile.assert_called_once_with(parameters.config_file)
     self.assertIsInstance(parameters, argparse.Namespace)
     self.assertEquals(parameters.config_file, self.config_file)
     self.assertEquals(parameters.log_name, LOG_NAME)
     self.assertEquals(parameters.append_log, False)
     self.assertEquals(parameters.log_level, LOG_LEVEL)