core: Fix review comments for PR#1111

This commit is contained in:
Thomas Adamcik 2015-04-08 23:13:07 +02:00
parent e5f59495fc
commit 2cc91c0a7f
2 changed files with 5 additions and 3 deletions

View File

@ -68,7 +68,9 @@ class LibraryController(object):
.. versionadded:: 0.18
"""
return self._roots() if uri is None else self._browse(uri)
if uri is None:
return self._roots()
return self._browse(uri)
def _roots(self):
directories = set()
@ -87,7 +89,7 @@ class LibraryController(object):
backend = self.backends.with_library_browse.get(scheme)
try:
if backend:
return backend.library.browse(uri).get() # TODO: sort?
return backend.library.browse(uri).get()
except Exception:
logger.exception('%s backend caused an exception.',
backend.actor_ref.actor_class.__name__)

View File

@ -443,7 +443,7 @@ class BackendFailuresCoreLibraryTest(unittest.TestCase):
self.assertEqual([], self.core.library.browse(None))
logger.exception.assert_called_with(mock.ANY, 'DummyBackend')
def test_browse_backend_browse_uri_exception_gets_through(self, logger):
def test_browse_backend_browse_uri_exception_gets_ignored(self, logger):
self.library.browse.return_value.get.side_effect = Exception
self.assertEqual([], self.core.library.browse('dummy:directory'))
logger.exception.assert_called_with(mock.ANY, 'DummyBackend')