def test_factory(self):
        """
        :return:
        """
        fti = queryUtility(IDexterityFTI, name=CONTENT_TYPE_BOOK)

        obj = createObject(fti.factory)

        self.assertTrue(IBook.providedBy(obj))
    def test_adding(self):
        """
        :return:
        """
        _id = safe_unicode('test-first-book')
        _title = safe_unicode('Test First Book')
        _isbn = safe_unicode('ISBN-01-90')

        self.library.invokeFactory(CONTENT_TYPE_BOOK, _id)
        book = self.library[_id]

        self.assertTrue(IBook.providedBy(book))

        book.setTitle(_title)
        book.isbn = _isbn

        book.reindexObject()

        result = self.portal.portal_catalog.searchResults(id=book.id)

        self.assertEquals(1, len(result))
        self.assertEqual(_title, result[0].Title)
        self.assertEquals(result[0].getObject().isbn, _isbn)