def test_classic_logger_is_used_by_default(self): config = testing.setUp() config.registry.settings = DEFAULT_SETTINGS classiclog_class = mock.patch('cliquet.logs.ClassicLogRenderer') with classiclog_class as mocked: initialization.setup_logging(config) mocked.assert_called_with(DEFAULT_SETTINGS)
def test_mozlog_logger_is_enabled_via_setting(self): mozlog_class = mock.patch('cliquet.logs.MozillaHekaRenderer') classiclog_class = mock.patch('cliquet.logs.ClassicLogRenderer') config = testing.setUp() with mock.patch.dict(config.registry.settings, [('logging_renderer', 'cliquet.logs.MozillaHekaRenderer')]): with mozlog_class as moz_mocked: with classiclog_class as classic_mocked: initialization.setup_logging(config) self.assertTrue(moz_mocked.called) self.assertFalse(classic_mocked.called)
def test_mozlog_logger_is_enabled_via_setting(self): mozlog_class = mock.patch('cliquet.logs.MozillaHekaRenderer') classiclog_class = mock.patch('cliquet.logs.ClassicLogRenderer') config = testing.setUp() with mock.patch.dict( config.registry.settings, [('logging_renderer', 'cliquet.logs.MozillaHekaRenderer')]): with mozlog_class as moz_mocked: with classiclog_class as classic_mocked: initialization.setup_logging(config) self.assertTrue(moz_mocked.called) self.assertFalse(classic_mocked.called)
def setUp(self): super(ResourceInfoTest, self).setUp() config = testing.setUp() config.registry.settings = DEFAULT_SETTINGS initialization.setup_logging(config)