remove_cover()

This commit is contained in:
Kovid Goyal 2013-07-17 22:16:45 +05:30
parent f75458224b
commit 93e68b1398
2 changed files with 11 additions and 0 deletions

View File

@ -664,6 +664,11 @@ class LibraryDatabase(object):
if changed and notify:
self.notify('metadata', [])
def remove_cover(self, book_id, notify=True, commit=True):
self.new_api.set_cover({book_id:None})
if notify:
self.notify('cover', [id])
# Private interface {{{
def __iter__(self):
for row in self.data.iterall():

View File

@ -345,6 +345,12 @@ class LegacyTest(BaseTest):
self.assertEqual(cache.field_for('authors', bid), ('calibre',))
self.assertEqual(cache.field_for('tags', bid), (_('News'), 'Events', 'one', 'two'))
self.assertTrue(legacy.cover(1, index_is_id=True))
self.assertTrue(legacy.has_cover(1))
legacy.remove_cover(1)
self.assertFalse(legacy.has_cover(1))
self.assertFalse(legacy.cover(1, index_is_id=True))
legacy.delete_book(1)
old.delete_book(1)
self.assertNotIn(1, legacy.all_ids())