def test_configure_logging_file(self, fileconfig_mock): cfgparser = MagicMock() cfg = Configuration(cfgparser) cfgparser.get.return_value = '/path/to/logging.conf' cfg.configure_logging() cfgparser.get.assert_called_once_with('daemon', 'logging_config') fileconfig_mock.assert_called_once_with('/path/to/logging.conf')
def test_configure_logging(self, basicconfig_mock): cfgparser = MagicMock() cfg = Configuration(cfgparser) cfgparser.get.side_effect = NoOptionError(None, None) cfg.configure_logging() cfgparser.get.assert_called_once_with('daemon', 'logging_config') basicconfig_mock.assert_called_once_with( stream=sys.stdout, format=ANY, level=ANY)