def test_config_configure_logging_c(self, mock_move, mock_size, mock_isfile, mock_logger, mock_file, mock_stream, mock_format): """Test _configure_logging""" _cfg = configparser.RawConfigParser() cfg = mock.create_autospec(Configuration) cfg._config = _cfg mock_logger.return_value = logging.getLogger("configure_logging_c") cfg._write_file = False Configuration._configure_logging(cfg, self.test_dir) self.assertFalse(mock_file.called) self.assertFalse(mock_size.called)
def test_config_configure_logging_a(self, mock_move, mock_size, mock_isfile, mock_logger, mock_file, mock_stream, mock_format): """Test _configure_logging""" _cfg = configparser.RawConfigParser() cfg = mock.create_autospec(Configuration) cfg._config = _cfg mock_logger.return_value = logging.getLogger("configure_logging_a") cfg._write_file = True mock_isfile.return_value = True mock_size.return_value = 20485760 Configuration._configure_logging(cfg, self.test_dir) self.assertTrue(mock_format.called) self.assertTrue(mock_move.called) self.assertTrue(mock_size.called) mock_file.assert_called_with( os.path.join(self.test_dir, "batch_apps.log"))
def test_config_configure_logging_c(self, mock_move, mock_size, mock_isfile, mock_logger, mock_file, mock_stream, mock_format): """Test _configure_logging""" _cfg = configparser.RawConfigParser() cfg = mock.create_autospec(Configuration) cfg._config = _cfg mock_logger.return_value = logging.getLogger("configure_logging_c") cfg._write_file = False Configuration._configure_logging(cfg, self.test_dir) self.assertFalse(mock_file.called) self.assertFalse(mock_size.called)
def test_config_configure_logging_a(self, mock_move, mock_size, mock_isfile, mock_logger, mock_file, mock_stream, mock_format): """Test _configure_logging""" _cfg = configparser.RawConfigParser() cfg = mock.create_autospec(Configuration) cfg._config = _cfg mock_logger.return_value = logging.getLogger("configure_logging_a") cfg._write_file = True mock_isfile.return_value = True mock_size.return_value = 20485760 Configuration._configure_logging(cfg, self.test_dir) self.assertTrue(mock_format.called) self.assertTrue(mock_move.called) self.assertTrue(mock_size.called) mock_file.assert_called_with( os.path.join(self.test_dir, "batch_apps.log"))