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

        obj = createObject(fti.factory)

        self.assertTrue(IStudent.providedBy(obj))
    def test_adding(self):
        """
        :return:
        """
        _id = safe_unicode('test-first-name')
        _first_name = safe_unicode('Test First Name')
        _last_name = safe_unicode('Last')

        self.school.invokeFactory(CONTENT_TYPE_STUDENT, _id)
        student = self.school[_id]

        self.assertTrue(IStudent.providedBy(student))

        student.first_name = _first_name
        student.last_name = _last_name

        student.reindexObject()

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

        self.assertEquals(1, len(result))
        self.assertEqual(_first_name + ' ' + _last_name, result[0].Title)
        self.assertEquals(result[0].getObject().first_name, _first_name)