def test_get_log_levels(self, get_log_mock): get_log_mock.return_value = {'cinder': 'DEBUG', 'cinder.api': 'ERROR'} service = manager.Manager() log_request = objects.LogLevel(prefix='sqlalchemy.') result = service.get_log_levels(mock.sentinel.context, log_request) get_log_mock.assert_called_once_with(log_request.prefix) expected = (objects.LogLevel(prefix='cinder', level='DEBUG'), objects.LogLevel(prefix='cinder.api', level='ERROR')) self.assertEqual(set(str(r) for r in result.objects), set(str(e) for e in expected))
def test_set_log_levels(self, set_log_mock): service = manager.Manager() log_request = objects.LogLevel(prefix='sqlalchemy.', level='debug') service.set_log_levels(mock.sentinel.context, log_request) set_log_mock.assert_called_once_with(log_request.prefix, log_request.level)