'Test the adding of new books'

def test_add_books(self):

    from calibre.ebooks.metadata.book.base import Metadata
    cache = self.init_cache()
    mi = Metadata(u'Created    One', authors=(u'Creator    One', u'Creator    Two'))
    (FMT1, FMT2) = ('format1', 'format2')
    format_map = {u'FMT1': BytesIO(FMT1), u'FMT2': BytesIO(FMT2)}
    (ids, duplicates) = cache.add_books([(mi, format_map)])
    self.assertTrue((len(ids) == 1))
    self.assertFalse(duplicates)
    book_id = ids[0]
    self.assertEqual(set(cache.formats(book_id)), {u'FMT1', u'FMT2'})
    self.assertEqual(cache.format(book_id, u'FMT1'), FMT1)
    self.assertEqual(cache.format(book_id, u'FMT2'), FMT2)
