Beispiel #1
0
 def setUp(self):
     portal = self.layer['portal']
     self.tp_catalog = portal.tablepage_catalog
     login(portal, TEST_USER_NAME)
     portal.invokeFactory(type_name='TablePage', id='table_page', title="The Table Document")
     tp = portal.table_page
     tp.edit(pageColumns=[{'id': 'foo_field', 'label': 'Foo field', 'description': '',
                           'type': 'String', 'vocabulary': '', 'options': []},
                           ],
             batchSize=10)
     tp.edit(searchConfig=[{'id': 'foo_field', 'label': '', 'description': '',
                            'additionalConfiguration': ['SearchableText']}])
     self.tp = tp
     self.storage = IDataStorage(tp)
     self._addRows(35)
     # now adding another tablepage: this must be always ignored by searches
     portal.invokeFactory(type_name='TablePage', id='table_page2', title="Another Table Document")
     portal.table_page2.edit(pageColumns=[{'id': 'foo_field', 'label': 'Foo field', 'description': '',
                                           'type': 'String', 'vocabulary': '', 'options': []},
                                           ],
                                           batchSize=10)
     storage2 = IDataStorage(portal.table_page2)
     storage2.add({'__label__': 'A Label', '__uuid__': 'l2l2l2'})
     storage2.add({'foo_field': 'aa001', '__uuid__': '010'})
     portal.portal_workflow.doActionFor(tp, 'publish')
     self.tp_catalog.clearFindAndRebuild()
     logout()
Beispiel #2
0
 def test_encoding(self):
     """Be sure that we have no problems with non-ASCII chars"""
     portal = self.layer['portal']
     portal.invokeFactory(type_name='TablePage',
                          id='table_page',
                          title="The Table Document")
     tp = portal.table_page
     tp.edit(textBefore='<p>L\xc3\xb2r\xc3\xa8m Ips\xc3\xb9m</p>',
             pageColumns=[{
                 'id': 'col_a',
                 'label': 'Col A',
                 'description': 'Th\xc3\xacs data is futile',
                 'type': 'String',
                 'vocabulary': '',
                 'options': []
             }])
     storage = IDataStorage(tp)
     storage.add({
         '__creator__': 'user1',
         'col_a': 'F\xc3\xb2\xc3\xb2 data from user1',
         '__uuid__': 'aaa'
     })
     try:
         tp.getText()
     except UnicodeDecodeError:
         self.fail("getText() raised UnicodeDecodeError unexpectedly!")
Beispiel #3
0
 def setUp(self):
     portal = self.layer['portal']
     self.tp_catalog = portal.tablepage_catalog
     login(portal, TEST_USER_NAME)
     portal.invokeFactory(type_name='TablePage', id='table_page', title="The Table Document")
     tp = portal.table_page
     tp.edit(pageColumns=[{'id': 'foo_field', 'label': 'Foo field', 'description': '',
                           'type': 'String', 'vocabulary': '', 'options': []},
                           ],
             batchSize=10)
     tp.edit(searchConfig=[{'id': 'foo_field', 'label': '', 'description': '',
                            'additionalConfiguration': ['SearchableText']}])
     self.tp = tp
     self.storage = IDataStorage(tp)
     self._addRows(35)
     # now adding another tablepage: this must be always ignored by searches
     portal.invokeFactory(type_name='TablePage', id='table_page2', title="Another Table Document")
     portal.table_page2.edit(pageColumns=[{'id': 'foo_field', 'label': 'Foo field', 'description': '',
                                           'type': 'String', 'vocabulary': '', 'options': []},
                                           ],
                                           batchSize=10)
     storage2 = IDataStorage(portal.table_page2)
     storage2.add({'__label__': 'A Label', '__uuid__': 'l2l2l2'})
     storage2.add({'foo_field': 'aa001', '__uuid__': '010'})
     portal.portal_workflow.doActionFor(tp, 'publish')
     self.tp_catalog.clearFindAndRebuild()
     logout()
Beispiel #4
0
 def test_encoding_on_rendering(self):
     """Be sure that we have no problems with non-ASCII chars"""
     self.portal.invokeFactory(type_name='TablePage',
                               id='table_page',
                               title="The Table Document")
     tp = self.portal.table_page
     tp.edit(textBefore='<p>L\xc3\xb2r\xc3\xa8m Ips\xc3\xb9m</p>',
             pageColumns=[{
                 'id': 'col_a',
                 'label': 'Col A',
                 'description': 'Th\xc3\xacs data is futile',
                 'type': 'String',
                 'vocabulary': '',
                 'options': []
             }])
     storage = IDataStorage(tp)
     storage.add({
         '__creator__': 'user1',
         'col_a': 'F\xc3\xb2\xc3\xb2 data from user1',
         '__uuid__': 'aaa'
     })
     adapter = getMultiAdapter((tp, self.request),
                               interface=IColumnField,
                               name=u'String')
     adapter.configuration = tp.getPageColumns()[0]
     try:
         adapter.render_edit('F\xc3\xb2\xc3\xb2 data from user1')
     except UnicodeDecodeError:
         self.fail("getText() raised UnicodeDecodeError unexpectedly!")
Beispiel #5
0
 def test_catalog_reindex_rows(self):
     portal = self.layer['portal']
     self.add_rows()
     tp = portal.table_page1
     storage = IDataStorage(tp)
     portal = self.layer['portal']
     data = {
         '__creator__': 'user1',
         'col_a': 'Proin elementum',
         '__uuid__': 'ccc'
     }
     storage.add(data)
     self.tp_catalog.catalog_row(tp, data)
     self.assertEqual(len(list(self.tp_catalog.searchTablePage(tp))), 3)
     self.assertEqual(
         self.tp_catalog.searchTablePage(tp)[0]._unrestrictedGetObject()
         ['col_a'], 'Lorem ipsum')
     self.assertEqual(
         self.tp_catalog.searchTablePage(tp)[1]._unrestrictedGetObject()
         ['col_a'], 'dolor sit amet')
     self.assertEqual(
         self.tp_catalog.searchTablePage(tp)[2]._unrestrictedGetObject()
         ['col_a'], 'Proin elementum')
     data = storage.get('bbb')
     del storage['bbb']
     storage.add(data, 2)
     self.tp_catalog.reindex_rows(tp, ['bbb', 'ccc'])
     self.assertEqual(
         self.tp_catalog.searchTablePage(tp)[1]._unrestrictedGetObject()
         ['col_a'], 'Proin elementum')
     self.assertEqual(
         self.tp_catalog.searchTablePage(tp)[2]._unrestrictedGetObject()
         ['col_a'], 'dolor sit amet')
 def test_computed_general_tal_access(self):
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'simple_column': 'Lorem ipsum'})
     configuration = tp.getPageColumns()
     configuration[-1]['vocabulary'] = 'portal/title'
     field = self._getField()
     self.assertEquals(field.render_view('foo', 0).strip(), 'Plone site')
 def test_computed_file_access(self):
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'column_file': portal.file1.UID()})
     configuration = tp.getPageColumns()
     configuration[-1]['vocabulary'] = 'row/column_file/Title'
     field = self._getField()
     self.assertEquals(field.render_view('foo', 0).strip(), 'One file')
 def test_computed_multiple_files_access(self):
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'column_files': "%s\n%s" % (portal.file1.UID(), portal.file2.UID())})
     configuration = tp.getPageColumns()
     configuration[-1]['vocabulary'] = "python:row['column_files'][1].Title()"
     field = self._getField()
     self.assertEquals(field.render_view('foo', 0).strip(), 'Another file')
Beispiel #9
0
 def test_reference_document_edit(self):
     portal = self.layer['portal']
     request = self.layer['request']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'__creator__': TEST_USER_NAME, 'link': portal.document.UID(),
                  '__uuid__': 'aaa'})
     request.form['row-index'] = 0
     view = getMultiAdapter((tp, request), name=u'edit-record')
     self.assertTrue('value="%s"' % portal.document.Title().decode('utf-8') in view())
Beispiel #10
0
 def test_template_override_icon(self):
     portal = self.layer['portal']
     tp = portal.table_page
     tp.edit(pageColumns=[{'id': 'link', 'label': 'Link', 'description': '',
                           'type': 'Link', 'vocabulary': 'icon:src-to-an-icon', 'options': []}])
     storage = IDataStorage(tp)
     storage.add({'__creator__': TEST_USER_NAME, 'link': portal.document.UID(),
                  '__uuid__': 'aaa'})
     output = tp()
     self.assertTrue(u'<img src="src-to-an-icon" alt="A d\xf2cument to reference" />' in output)
Beispiel #11
0
 def test_template_override_text(self):
     portal = self.layer['portal']
     tp = portal.table_page
     tp.edit(pageColumns=[{'id': 'link', 'label': 'Link', 'description': '',
                           'type': 'Link', 'vocabulary': 'title:Lorèm ipsum', 'options': []}])
     storage = IDataStorage(tp)
     storage.add({'__creator__': TEST_USER_NAME, 'link': portal.document.UID(),
                  '__uuid__': 'aaa'})
     output = tp()
     self.assertTrue(u'Lor\xe8m ipsum' in output)
Beispiel #12
0
 def test_url_edit(self):
     portal = self.layer['portal']
     request = self.layer['request']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'__creator__': TEST_USER_NAME, 'link': 'http://foo.com/',
                  '__uuid__': 'aaa'})
     request.form['row-index'] = 0
     view = getMultiAdapter((tp, request), name=u'edit-record')
     self.assertTrue('http://foo.com/' in view())
 def test_computed_link_access(self):
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'column_link': portal.document.UID()})
     storage.add({'column_link': 'http://plone.org/'})
     configuration = tp.getPageColumns()
     configuration[-1]['vocabulary'] = "row/column_link/Title|row/column_link"
     field = self._getField()
     self.assertEquals(field.render_view('foo', 0).strip(), 'A document to reference')
     self.assertEquals(field.render_view('foo', 1).strip(), 'http://plone.org/')
Beispiel #14
0
 def test_move_my_row(self):
     """Owners normally can't move rows"""
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user1', 'col_a': 'foo data from user1',
                  '__uuid__': 'aaa'})
     storage.add({'__creator__': 'user1', 'col_a': 'some other futile data',
                  '__uuid__': 'bbb'})
     login(portal, 'user1')
     self.assertRaises(Unauthorized, tp.restrictedTraverse, '@@move-record')
Beispiel #15
0
 def test_view_forbidden_attachment(self):
     """Although attachment is not accessible, normal table visitor can see the link"""
     portal = self.layer['portal']
     tp = portal.table_page
     folder = portal.folder
     tp.manage_setLocalRoles('user0', ('Contributor',))
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user0', 'att': folder.attachment.UID(),
                  '__uuid__': 'aaa'})
     logout()
     self.assertTrue('An ancient attachment' in tp())
Beispiel #16
0
 def test_modify_his_row(self):
     """user2 can't modify other user's data"""
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user1', 'col_a': 'foo data from user1',
                  '__uuid__': 'aaa'})
     login(portal, 'user2')
     view = tp.restrictedTraverse('@@edit-record')
     view.request.form['row-index'] = 0
     self.assertRaises(Unauthorized, view)
 def test_rows_var_access(self):
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'simple_column': 'Lorem ipsum'})
     configuration = tp.getPageColumns()
     configuration[-1]['vocabulary'] = "python:rows.get(0)['simple_column']"
     field = self._getField()
     self.assertEquals(field.render_view('foo', 0).strip(), 'Lorem ipsum')
     storage.add({'simple_column': 'dolor sit amet'})
     field = self._getField()
     self.assertEquals(field.render_view('foo', 1).strip(), 'Lorem ipsum')
Beispiel #18
0
 def test_delete_my_row(self):
     """Owners can delete proper rows"""
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user1', 'col_a': 'foo data from user1',
                  '__uuid__': 'aaa'})
     login(portal, 'user1')
     view = tp.restrictedTraverse('@@delete-record')
     view.request.form['row-index'] = 0
     view()
     self.assertEqual(len(storage), 0)
Beispiel #19
0
 def test_editor_modify_his_row(self):
     """user3 can modify other user's data"""
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user1', 'col_a': 'foo data from user1',
                  '__uuid__': 'aaa'})
     login(portal, 'user3')
     view = tp.restrictedTraverse('@@edit-record')
     view.request.form['row-index'] = 0
     self.assertTrue('Edit row' in view())
     self.assertTrue('foo data from user1' in view())
 def setUp(self):
     portal = self.layer['portal']
     login(portal, TEST_USER_NAME)
     portal.invokeFactory(type_name='TablePage', id='table_page', title="The Table Document")
     tp = portal.table_page
     tp.edit(pageColumns=[{'id': 'col_a', 'label': 'Col A', 'description': '',
                           'type': 'String', 'vocabulary': '', 'options': []}])
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user1', 'col_a': 'Lorem', '__uuid__': 'aaa'})
     storage.add({'__creator__': 'user1', 'col_a': 'Ipsum', '__uuid__': 'bbb'})
     storage.add({'__creator__': 'user1', 'col_a': 'Sit', '__uuid__': 'ccc'})
     self.tp_catalog = getToolByName(portal, 'tablepage_catalog')
Beispiel #21
0
 def test_frontend_url(self):
     """We will have resolveuid URL in backend, but real URL on table view"""
     tp = self.tp
     request = self.layer['request']
     portal = self.layer['portal']
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user0', 'att': portal.folder.attachment1.UID(),
                  '__uuid__': 'aaa'})
     view = getMultiAdapter((tp, request), name='tablepage-edit')
     self.assertTrue('href="resolveuid/%s/at_download/file"' % \
                                 portal.folder.attachment1.UID() in view())
     self.assertTrue('href="http://nohost/plone/folder/attachment1/at_download/file"' in tp())
 def test_url_edit(self):
     portal = self.layer['portal']
     request = self.layer['request']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({
         '__creator__': TEST_USER_NAME,
         'link': 'http://foo.com/',
         '__uuid__': 'aaa'
     })
     request.form['row-index'] = 0
     view = getMultiAdapter((tp, request), name=u'edit-record')
     self.assertTrue('http://foo.com/' in view())
Beispiel #23
0
 def test_editor_move_his_row(self):
     """Editor can move rows"""
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user1', 'col_a': 'foo data from user1', '__uuid__': 'aaa'})
     storage.add({'__creator__': 'user1', 'col_a': 'some other futile data', '__uuid__': 'bbb'})
     login(portal, 'user3')
     view = tp.restrictedTraverse('@@move-record')
     view.request.form['row-index'] = 0
     view.request.form['direction'] = 'down'
     view()
     self.assertEqual(storage[0].get('col_a'), 'some other futile data')
Beispiel #24
0
 def test_delete_old_data(self):
     portal = self.layer['portal']
     request = self.layer['request']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user0', 'att': portal.folder.attachment.UID(),
                  '__uuid__': 'aaa'})
     request.form['row-index'] = 0
     request.form['form.submitted'] = "1"
     request.form['existing_att'] = ''
     view = getMultiAdapter((tp, request), name='edit-record')
     view()
     self.assertFalse(storage[0]['att']==portal.folder.attachment.UID())
     self.assertEqual(storage[0]['att'], '')
Beispiel #25
0
 def add_rows(self):
     portal = self.layer['portal']
     storage = IDataStorage(portal.table_page1)
     data = {
         '__creator__': 'user1',
         'col_a': 'Lorem ipsum',
         '__uuid__': 'aaa'
     }
     storage.add(data)
     self.tp_catalog.catalog_row(portal.table_page1, data)
     data = {
         '__creator__': 'user1',
         'col_a': 'dolor sit amet',
         '__uuid__': 'bbb'
     }
     storage.add(data)
     self.tp_catalog.catalog_row(portal.table_page1, data)
     # another TP
     storage = IDataStorage(portal.table_page2)
     data = {
         '__creator__': 'user1',
         'col_a': 'consectetur adipisicing elit',
         '__uuid__': 'ccc'
     }
     storage.add(data)
     self.tp_catalog.catalog_row(portal.table_page2, data)
     data = {
         '__creator__': 'user1',
         'col_a': 'sed do eiusmod tempor',
         '__uuid__': 'ddd'
     }
     storage.add(data)
     self.tp_catalog.catalog_row(portal.table_page2, data)
 def test_view_forbidden_attachment(self):
     """Although attachment is not accessible, normal table visitor can see the link"""
     portal = self.layer['portal']
     tp = portal.table_page
     folder = portal.folder
     tp.manage_setLocalRoles('user0', ('Contributor', ))
     storage = IDataStorage(tp)
     storage.add({
         '__creator__': 'user0',
         'att': folder.attachment.UID(),
         '__uuid__': 'aaa'
     })
     logout()
     self.assertTrue('An ancient attachment' in tp())
 def setUp(self):
     portal = self.layer['portal']
     login(portal, TEST_USER_NAME)
     portal.invokeFactory(type_name='TablePage',
                          id='table_page',
                          title="The Table Document")
     tp = portal.table_page
     tp.edit(pageColumns=[{
         'id': 'col_a',
         'label': 'Col A',
         'description': 'Th\xc3\xacs data is futile',
         'type': 'String',
         'vocabulary': '',
         'options': []
     }])
     storage = IDataStorage(tp)
     storage.add({
         '__creator__': 'user1',
         'col_a': 'F\xc3\xb2\xc3\xb2 data from user1',
         '__uuid__': 'aaa'
     })
     storage.add({'__label__': 'A label'})
     storage.add({
         '__creator__': 'user1',
         'col_a': 'Other data from user1',
         '__uuid__': 'bbb'
     })
     storage.add({
         '__creator__': 'user1',
         'col_a': 'Again data from user1',
         '__uuid__': 'ccc'
     })
     self.storage = storage
 def test_reference_document_edit(self):
     portal = self.layer['portal']
     request = self.layer['request']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({
         '__creator__': TEST_USER_NAME,
         'link': portal.document.UID(),
         '__uuid__': 'aaa'
     })
     request.form['row-index'] = 0
     view = getMultiAdapter((tp, request), name=u'edit-record')
     self.assertTrue('value="%s"' %
                     portal.document.Title().decode('utf-8') in view())
Beispiel #29
0
 def test_delete_old_data(self):
     portal = self.layer['portal']
     request = self.layer['request']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'__creator__': TEST_USER_NAME, 'link': portal.document.UID(),
                  '__uuid__': 'aaa'})
     request.form['row-index'] = 0
     request.form['form.submitted'] = '1'
     request.form['external_link'] = ''
     request.form['internal_link'] = ''
     view = getMultiAdapter((tp, request), name=u'edit-record')
     view()
     self.assertFalse(storage[0]['link']==portal.document.UID())
     self.assertEqual(storage[0]['link'], '')
 def test_encoding(self):
     """Be sure that we have no problems with non-ASCII chars"""
     portal = self.layer['portal']
     portal.invokeFactory(type_name='TablePage', id='table_page', title="The Table Document")
     tp = portal.table_page
     tp.edit(textBefore='<p>L\xc3\xb2r\xc3\xa8m Ips\xc3\xb9m</p>',
             pageColumns=[{'id': 'col_a', 'label': 'Col A', 'description': 'Th\xc3\xacs data is futile',
                           'type': 'String', 'vocabulary': '', 'options': []}])
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user1', 'col_a': 'F\xc3\xb2\xc3\xb2 data from user1',
                  '__uuid__': 'aaa'})
     try:
         tp.getText()
     except UnicodeDecodeError:
         self.fail("getText() raised UnicodeDecodeError unexpectedly!")
Beispiel #31
0
 def test_add_begin_of_group_2(self):
     # When the first row is a label, always add after it
     portal = self.layer['portal']
     tp = portal.table_page
     tp.setInsertType('prepend')
     storage = IDataStorage(tp)
     storage.add({'__label__': 'New label'}, 0)                  # 0
     login(portal, 'user2')
     view = tp.restrictedTraverse('@@edit-record')
     view.request.form['addRow'] = '1'
     view.request.form['form.submitted'] = '1'
     view.request.form['row-index'] = 0
     view.request.form['col_a'] = 'Added by me!'
     view()
     self.assertEqual(storage[1].get('col_a'), 'Added by me!')
Beispiel #32
0
    def test_size_option(self):
        portal = self.layer['portal']
        portal.invokeFactory(type_name='Image', id='image', title="An image")

        tp = portal.table_page
        tp.edit(textBefore='<p>Lorem Ipsum</p>',
                pageColumns=[{'id': 'att', 'label': 'Attachment', 'description': '',
                              'type': 'Image', 'vocabulary': 'size:icon', 'options': []}],
                attachmentStorage=portal.folder.UID())

        storage = IDataStorage(tp)
        storage.add({'__creator__': TEST_USER_NAME, 'att': portal.image.UID(),
                     '__uuid__': 'aaa'})

        output = tp()
        self.assertTrue(u'<img src="resolveuid/' + portal.image.UID() + u'/image_icon"' in output)
 def test_delete_old_data(self):
     portal = self.layer['portal']
     request = self.layer['request']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({
         '__creator__': 'user0',
         'att': portal.folder.attachment.UID(),
         '__uuid__': 'aaa'
     })
     request.form['row-index'] = 0
     request.form['form.submitted'] = "1"
     request.form['existing_att'] = ''
     view = getMultiAdapter((tp, request), name='edit-record')
     view()
     self.assertFalse(storage[0]['att'] == portal.folder.attachment.UID())
     self.assertEqual(storage[0]['att'], '')
 def test_frontend_url(self):
     """We will have resolveuid URL in backend, but real URL on table view"""
     tp = self.tp
     request = self.layer['request']
     portal = self.layer['portal']
     storage = IDataStorage(tp)
     storage.add({
         '__creator__': 'user0',
         'att': portal.folder.attachment1.UID(),
         '__uuid__': 'aaa'
     })
     view = getMultiAdapter((tp, request), name='tablepage-edit')
     self.assertTrue('href="resolveuid/%s/at_download/file"' % \
                                 portal.folder.attachment1.UID() in view())
     self.assertTrue(
         'href="http://nohost/plone/folder/attachment1/at_download/file"' in
         tp())
Beispiel #35
0
class CachingTestCase(unittest.TestCase):
    
    layer = TABLE_PAGE_INTEGRATION_TESTING
    
    def setUp(self):
        portal = self.layer['portal']
        login(portal, TEST_USER_NAME)
        portal.invokeFactory(type_name='TablePage', id='table_page', title="The Table Document")
        tp = portal.table_page
        tp.edit(pageColumns=[{'id': 'the_text_data', 'label': 'A text', 'description': '',
                              'type': 'Text', 'vocabulary': '', 'options': []}
        ])
        self.storage = IDataStorage(tp)

    def test_cache_miss(self):
        portal = self.layer['portal']
        request = self.layer['request']
        request.form['form.submitted'] = '1'
        request.form['the_text_data'] = 'Lorem ipsum'
        tp = portal.table_page
        view = getMultiAdapter((tp, request), name='edit-record')
        view()
        self.assertEqual(self.storage[0]['__cache__']['the_text_data']['data'], '<p>Lorem ipsum</p>\n')
        self.assertTrue(self.storage[0]['__cache__']['the_text_data']['timestamp'] < DateTime().millis())

    def test_cache_hit(self):
        portal = self.layer['portal']
        tomorrow = DateTime() + 1
        self.storage.add({'__creator__': 'foo', 'the_text_data': 'foo bar baz',
                          '__uuid__': 'aaa',
                          '__cache__': {'the_text_data': {'data': 'In cache we believe',
                                                          'timestamp': tomorrow.millis()}}})
        output = portal.table_page()
        self.assertTrue('In cache we believe' in output)
        self.assertFalse('foo bar baz' in output)

    def test_cache_miss_timestamp_expired(self):
        portal = self.layer['portal']
        self.storage.add({'__creator__': 'foo', 'the_text_data': 'foo bar baz',
                          '__uuid__': 'aaa',
                          '__cache__': {'the_text_data': {'data': 'In cache we believe',
                                                          'timestamp': 0}}})
        output = portal.table_page()
        self.assertFalse('In cache we believe' in output)
        self.assertTrue('<p>foo bar baz</p>' in output)
 def test_delete_old_data(self):
     portal = self.layer['portal']
     request = self.layer['request']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({
         '__creator__': TEST_USER_NAME,
         'link': portal.document.UID(),
         '__uuid__': 'aaa'
     })
     request.form['row-index'] = 0
     request.form['form.submitted'] = '1'
     request.form['external_link'] = ''
     request.form['internal_link'] = ''
     view = getMultiAdapter((tp, request), name=u'edit-record')
     view()
     self.assertFalse(storage[0]['link'] == portal.document.UID())
     self.assertEqual(storage[0]['link'], '')
 def test_sort_no_values(self):
     portal = self.layer['portal']
     request = self.layer['request']
     portal.invokeFactory(type_name='TablePage', id='table_page', title="The Table Document")
     tp = portal.table_page
     tp.edit(pageColumns=[{'id': 'col_a', 'label': 'Col A', 'description': '',
                           'type': 'String', 'vocabulary': '', 'options': []},
                          {'id': 'col_b', 'label': 'Col B', 'description': '',
                           'type': 'String', 'vocabulary': '', 'options': []}])
     view = getMultiAdapter((tp, request), name='view-table')
     self.assertEqual(view.sort_by(), None)
     self.assertEqual(view.sort_order(), 'asc')
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user1', 'col_a': 'Lorem', 'col_b': 'Lorem', '__uuid__': 'aaa'})
     storage.add({'__creator__': 'user1', 'col_a': 'Ipsum', 'col_b': 'Ipsum', '__uuid__': 'bbb'})
     storage.add({'__creator__': 'user1', 'col_a': 'Sit', 'col_b': 'Sit', '__uuid__': 'ccc'})
     out = view()
     self.assertNotIn('data-sort-by', out)
     self.assertIn('data-sort-order="asc"', out)
 def test_template_override_text(self):
     portal = self.layer['portal']
     tp = portal.table_page
     tp.edit(pageColumns=[{
         'id': 'link',
         'label': 'Link',
         'description': '',
         'type': 'Link',
         'vocabulary': 'title:Lorèm ipsum',
         'options': []
     }])
     storage = IDataStorage(tp)
     storage.add({
         '__creator__': TEST_USER_NAME,
         'link': portal.document.UID(),
         '__uuid__': 'aaa'
     })
     output = tp()
     self.assertTrue(u'Lor\xe8m ipsum' in output)
 def test_template_override_icon(self):
     portal = self.layer['portal']
     tp = portal.table_page
     tp.edit(pageColumns=[{
         'id': 'link',
         'label': 'Link',
         'description': '',
         'type': 'Link',
         'vocabulary': 'icon:src-to-an-icon',
         'options': []
     }])
     storage = IDataStorage(tp)
     storage.add({
         '__creator__': TEST_USER_NAME,
         'link': portal.document.UID(),
         '__uuid__': 'aaa'
     })
     output = tp()
     self.assertTrue(
         u'<img src="src-to-an-icon" alt="A d\xf2cument to reference" />' in
         output)
Beispiel #40
0
 def setUp(self):
     portal = self.layer['portal']
     login(portal, TEST_USER_NAME)
     portal.invokeFactory(type_name='TablePage',
                          id='table_page',
                          title="The Table Document")
     tp = portal.table_page
     tp.edit(pageColumns=[{
         'id': 'col_a',
         'label': 'Col A',
         'description': '',
         'type': 'String',
         'vocabulary': '',
         'options': []
     }])
     storage = IDataStorage(tp)
     storage.add({
         '__creator__': 'user1',
         'col_a': 'Lorem',
         '__uuid__': 'aaa'
     })
     storage.add({
         '__creator__': 'user1',
         'col_a': 'Ipsum',
         '__uuid__': 'bbb'
     })
     storage.add({
         '__creator__': 'user1',
         'col_a': 'Sit',
         '__uuid__': 'ccc'
     })
     self.tp_catalog = getToolByName(portal, 'tablepage_catalog')
     self.tp_catalog.manage_catalogRebuild()
Beispiel #41
0
 def setUp(self):
     portal = self.layer['portal']
     login(portal, TEST_USER_NAME)
     portal.invokeFactory(type_name='TablePage', id='table_page', title="The Table Document")
     tp = portal.table_page
     tp.edit(pageColumns=[{'id': 'col_a', 'label': 'Col A', 'description': 'Th\xc3\xacs data is futile',
                           'type': 'String', 'vocabulary': '', 'options': []}])
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user1', 'col_a': 'F\xc3\xb2\xc3\xb2 data from user1',
                  '__uuid__': 'aaa'})
     storage.add({'__label__': 'A label'})
     storage.add({'__creator__': 'user1', 'col_a': 'Other data from user1',
                  '__uuid__': 'bbb'})
     storage.add({'__creator__': 'user1', 'col_a': 'Again data from user1',
                  '__uuid__': 'ccc'})
     self.storage = storage
Beispiel #42
0
 def add_rows(self):
     portal = self.layer['portal']
     storage = IDataStorage(portal.table_page1)
     data = {'__creator__': 'user1', 'col_a': 'Lorem ipsum', '__uuid__': 'aaa'}
     storage.add(data)
     self.tp_catalog.catalog_row(portal.table_page1, data)
     data = {'__creator__': 'user1', 'col_a': 'dolor sit amet', '__uuid__': 'bbb'}
     storage.add(data)
     self.tp_catalog.catalog_row(portal.table_page1, data)
     # another TP
     storage = IDataStorage(portal.table_page2)
     data = {'__creator__': 'user1', 'col_a': 'consectetur adipisicing elit', '__uuid__': 'ccc'}
     storage.add(data)
     self.tp_catalog.catalog_row(portal.table_page2, data)
     data = {'__creator__': 'user1', 'col_a': 'sed do eiusmod tempor', '__uuid__': 'ddd'}
     storage.add(data)
     self.tp_catalog.catalog_row(portal.table_page2, data)
Beispiel #43
0
 def test_catalog_reindex_rows(self):
     portal = self.layer['portal']
     self.add_rows()
     tp = portal.table_page1
     storage = IDataStorage(tp)
     portal = self.layer['portal']
     data = {'__creator__': 'user1', 'col_a': 'Proin elementum', '__uuid__': 'ccc'}
     storage.add(data)
     self.tp_catalog.catalog_row(tp, data)
     self.assertEqual(len(list(self.tp_catalog.searchTablePage(tp))), 3)
     self.assertEqual(self.tp_catalog.searchTablePage(tp)[0]._unrestrictedGetObject()['col_a'],
                      'Lorem ipsum')
     self.assertEqual(self.tp_catalog.searchTablePage(tp)[1]._unrestrictedGetObject()['col_a'],
                      'dolor sit amet')
     self.assertEqual(self.tp_catalog.searchTablePage(tp)[2]._unrestrictedGetObject()['col_a'],
                      'Proin elementum')
     data = storage.get('bbb')
     del storage['bbb']
     storage.add(data, 2)
     self.tp_catalog.reindex_rows(tp, ['bbb', 'ccc'])
     self.assertEqual(self.tp_catalog.searchTablePage(tp)[1]._unrestrictedGetObject()['col_a'],
                      'Proin elementum')
     self.assertEqual(self.tp_catalog.searchTablePage(tp)[2]._unrestrictedGetObject()['col_a'],
                      'dolor sit amet')
Beispiel #44
0
 def test_sort(self):
     self.portal.invokeFactory(type_name='TablePage',
                               id='table_page',
                               title="The Table Document")
     tp = self.portal.table_page
     tp.edit(pageColumns=[{
         'id': 'col_a',
         'label': 'Col A',
         'description': '',
         'type': 'String',
         'vocabulary': '',
         'options': []
     }, {
         'id': 'col_b',
         'label': 'Col B',
         'description': '',
         'type': 'String',
         'vocabulary': '',
         'options': []
     }],
             sortBy='col_b',
             sortOrder='desc')
     view = self._get_view(tp)
     self.assertEqual(view.sort_by(), 1)
     self.assertEqual(view.sort_order(), 'desc')
     storage = IDataStorage(tp)
     storage.add({
         '__creator__': 'user1',
         'col_a': 'Lorem',
         'col_b': 'Lorem',
         '__uuid__': 'aaa'
     })
     storage.add({
         '__creator__': 'user1',
         'col_a': 'Ipsum',
         'col_b': 'Ipsum',
         '__uuid__': 'bbb'
     })
     storage.add({
         '__creator__': 'user1',
         'col_a': 'Sit',
         'col_b': 'Sit',
         '__uuid__': 'ccc'
     })
     out = view()
     self.assertIn('data-sort-by="1"', out)
     self.assertIn('data-sort-order="desc"', out)
Beispiel #45
0
 def setUp(self):
     portal = self.layer['portal']
     wtool = portal.portal_workflow
     login(portal, 'user1')
     portal.invokeFactory(type_name='TablePage', id='table_page', title="The Table Document")
     tp = portal.table_page
     tp.edit(textBefore='<p>Lorem Ipsum</p>',
             pageColumns=[{'id': 'col_a', 'label': 'Col A', 'description': '',
                           'type': 'String', 'vocabulary': '', 'options': []}])
     login(portal, TEST_USER_NAME)
     wtool.doActionFor(tp, 'publish')
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user1', 'col_a': 'foo', '__uuid__': 'aaa'})  # 0
     storage.add({'__creator__': 'user1', 'col_a': 'bar', '__uuid__': 'bbb'})  # 1
     storage.add({'__label__': 'A label', '__uuid__': 'ccc'})                  # 2
     storage.add({'__label__': 'B label', '__uuid__': 'ddd'})                  # 3
     storage.add({'__creator__': 'user1', 'col_a': 'baz', '__uuid__': 'eee'})  # 4
     storage.add({'__creator__': 'user1', 'col_a': 'qux', '__uuid__': 'fff'})  # 5
Beispiel #46
0
class SelectFieldTestCase(unittest.TestCase):
    
    layer = TABLE_PAGE_INTEGRATION_TESTING
    
    def setUp(self):
        portal = self.layer['portal']
        login(portal, TEST_USER_NAME)
        portal.invokeFactory(type_name='TablePage', id='table_page', title="The Table Document")
        tp = portal.table_page
        tp.edit(pageColumns=[{'id': 'foo', 'label': 'Select one', 'description': '',
                              'type': 'Select', 'vocabulary': 'Lorem\nIpsum\ndolor\nsit\n amet',
                              'options': []}
        ])
        self.storage = IDataStorage(tp)

    def test_access_creation_form(self):
        portal = self.layer['portal']
        request = self.layer['request']
        tp = portal.table_page
        view = getMultiAdapter((tp, request), name='edit-record')
        self.assertTrue('<select id="foo" name="foo">' in view())

    def test_access_edit_form(self):
        portal = self.layer['portal']
        request = self.layer['request']
        tp = portal.table_page
        self.storage.add({'__creator__': 'foo', 'foo': 'Ipsum'})
        request.form['row-index'] = 0
        view = getMultiAdapter((tp, request), name='edit-record')
        output = view()
        self.assertTrue('<select id="foo" name="foo">' in output)
        self.assertTrue('<option value="Ipsum" selected="selected">' in output)

    def test_access_computed_vocabulary(self):
        portal = self.layer['portal']
        request = self.layer['request']
        tp = portal.table_page
        tp.edit(pageColumns=[{'id': 'col1', 'label': 'Select one', 'description': '',
                              'type': 'Select', 'vocabulary': 'vocabulary:context/Subject\n'
                                                              'alpha\n'
                                                              'vocabulary:python:["item-1", "item-2", "item-3"]\n'
                                                              'omega\n',
                              'options': []}
        ])
        tp.setSubject(['foo', 'bar', 'baz'])
        self.storage.add({'__creator__': 'user1', 'col1': 'bar', '__uuid__': 'aaa'})
        request.form['row-index'] = 0
        view = getMultiAdapter((tp, request), name='edit-record')
        output = view()
        self.assertTrue('<option value="bar" selected="selected">bar</option>' in output)
        self.assertTrue('<option value="alpha">alpha</option>' in output)
        self.assertTrue('<option value="item-1">item-1</option>' in output)
        self.assertTrue('<option value="item-2">item-2</option>' in output)        
        self.assertTrue('<option value="omega">omega</option>' in output)

    def test_edit_computed_vocabulary(self):
        portal = self.layer['portal']
        request = self.layer['request']
        tp = portal.table_page
        tp.edit(pageColumns=[{'id': 'col1', 'label': 'Select one', 'description': '',
                              'type': 'Select', 'vocabulary': 'vocabulary:context/Subject\n'
                                                              'alpha\n'
                                                              'vocabulary:python:["item-1", "item-2", "item-3"]'
                                                              'omega\n',
                              'options': []}
        ])
        tp.setSubject(['foo', 'bar', 'baz'])
        self.storage.add({'__creator__': 'user1', 'col1': 'bar', '__uuid__': 'aaa'})
        request.form['row-index'] = 0
        request.form['form.submitted'] = '1'
        request.form['col1'] = 'baz'
        view = getMultiAdapter((tp, request), name='edit-record')
        view()
        self.assertEqual(self.storage[0]['col1'], 'baz')
Beispiel #47
0
class SearchWithBatchAndLabelTestCase(unittest.TestCase):

    layer = TABLE_PAGE_INTEGRATION_TESTING

    def setUp(self):
        portal = self.layer['portal']
        self.tp_catalog = portal.tablepage_catalog
        login(portal, TEST_USER_NAME)
        portal.invokeFactory(type_name='TablePage', id='table_page', title="The Table Document")
        tp = portal.table_page
        tp.edit(pageColumns=[{'id': 'foo_field', 'label': 'Foo field', 'description': '',
                              'type': 'String', 'vocabulary': '', 'options': []},
                              ],
                batchSize=10)
        tp.edit(searchConfig=[{'id': 'foo_field', 'label': '', 'description': '',
                               'additionalConfiguration': ['SearchableText']}])
        self.tp = tp
        self.storage = IDataStorage(tp)
        self._addRows(35)
        # now adding another tablepage: this must be always ignored by searches
        portal.invokeFactory(type_name='TablePage', id='table_page2', title="Another Table Document")
        portal.table_page2.edit(pageColumns=[{'id': 'foo_field', 'label': 'Foo field', 'description': '',
                                              'type': 'String', 'vocabulary': '', 'options': []},
                                              ],
                                              batchSize=10)
        storage2 = IDataStorage(portal.table_page2)
        storage2.add({'__label__': 'A Label', '__uuid__': 'l2l2l2'})
        storage2.add({'foo_field': 'aa001', '__uuid__': '010'})
        portal.portal_workflow.doActionFor(tp, 'publish')
        self.tp_catalog.clearFindAndRebuild()
        logout()

    def _addRows(self, nrows):
        for x in range(nrows):
            self.storage.add({'foo_field': 'aa%02d' % (x+1),
                              '__uuid__': '%05d' % (x+1)})

    def test_batching(self):
        tp = self.tp
        request = self.layer['request']
        request.form['searchInTable'] = '1'
        request.form['SearchableText'] = 'a*'
        self.storage.add({'foo_field': 'bbbbbbb', '__uuid__': '000'}, index=6)
        self.storage.add({'__label__': 'Section 1', '__uuid__': 'lll'}, index=3)
        self.tp_catalog.clearFindAndRebuild()
        output = tp()
        self.assertTrue('Section 1' in output)
        self.assertTrue('aa01' in output)
        self.assertTrue('aa09' in output)
        # this should be fixed someday
        self.assertFalse('aa10' in output)
        self.assertFalse('bbbbbbb' in output)

    def test_batching_page2(self):
        tp = self.tp
        request = self.layer['request']
        request.form['searchInTable'] = '1'
        request.form['SearchableText'] = 'a*'
        request.form['b_start'] = 10
        self.storage.add({'foo_field': 'bb', '__uuid__': '000'}, index=12)
        self.storage.add({'__label__': 'Section 1', '__uuid__': 'lll'}, index=3)
        self.tp_catalog.clearFindAndRebuild()
        output = tp()
        self.assertTrue('Section 1' in output)
        self.assertTrue('aa10' in output)
        self.assertFalse('bbbbbbb' in output)

    def test_batching_label_at_previous_page(self):
        tp = self.tp
        request = self.layer['request']
        request.form['searchInTable'] = '1'
        request.form['SearchableText'] = 'a*'
        request.form['b_start'] = 10
        self.storage.add({'foo_field': 'bb', '__uuid__': '000'}, index=11)
        self.storage.add({'__label__': 'Section 1', '__uuid__': 'lll'}, index=3)
        self.storage.add({'__label__': 'Section 2', '__uuid__': 'lll2'}, index=14)
        self.tp_catalog.clearFindAndRebuild()
        output = tp()
        self.assertTrue('Section 1' in output)
        self.assertTrue('Section 2' in output)
        self.assertTrue('aa10' in output)
        self.assertFalse('bbbbbbb' in output)
Beispiel #48
0
class TablePageCatalogTestCase(unittest.TestCase):

    layer = TABLE_PAGE_INTEGRATION_TESTING

    def setUp(self):
        portal = self.layer['portal']
        request = self.layer['request']
        login(portal, TEST_USER_NAME)
        portal.invokeFactory(type_name='TablePage', id='table_page', title="The Table Document")
        portal.table_page.edit(pageColumns=[{'id': 'col_a', 'label': 'Col A', 'description': '',
                                             'type': 'String', 'vocabulary': '', 'options': []},
                                            {'id': 'col_b', 'label': 'Col B', 'description': '',
                                             'type': 'String', 'vocabulary': '', 'options': []},
                                            {'id': 'col_c', 'label': 'Col C', 'description': '',
                                             'type': 'String', 'vocabulary': '', 'options': []}
        ])
        self.tp_catalog = portal.tablepage_catalog
        self.storage = IDataStorage(portal.table_page)
        request.set('ACTUAL_URL', 'http://nohost/plone/table_page')

    def index_args(self, id):
        return index_args(doc_attr=id, lexicon_id='pg_lexicon', index_type='Okapi BM25 Rank')

    def test_search_form_not_shown1(self):
        portal = self.layer['portal']
        output = portal.table_page()
        self.assertFalse('id="searchTablePage"' in output)

    def test_search_form_not_shown2(self):
        portal = self.layer['portal']
        tp = portal.table_page
        tp.edit(searchConfig=[{'id': 'col_a', 'label': '', 'description': '', 'additionalConfiguration': []}])
        self.assertFalse('id="searchTablePage"' in tp())

    def test_search_form_shown(self):
        portal = self.layer['portal']
        tp = portal.table_page
        tp.edit(searchConfig=[{'id': 'col_a', 'label': '', 'description': '', 'additionalConfiguration': []}])
        self.tp_catalog.addIndex('col_a', 'FieldIndex')
        output = tp()
        self.assertTrue('id="searchTablePage"' in output)

    def test_search_form_values_selector_shown(self):
        portal = self.layer['portal']
        tp = portal.table_page
        tp.edit(searchConfig=[{'id': 'col_a', 'label': '', 'description': '', 'additionalConfiguration': []}])
        self.storage.add({'__creator__': 'user1', 'col_a': 'Foo Bar Baz', '__uuid__': 'aaa'})
        self.tp_catalog.addIndex('col_a', 'FieldIndex')
        self.tp_catalog.clearFindAndRebuild()
        output = tp()
        self.assertTrue('<select name="col_a:list"' in output)
        self.assertTrue('<option value="Foo Bar Baz">' in output)

    def test_search_form_postback1(self):
        portal = self.layer['portal']
        request = self.layer['request']
        tp = portal.table_page
        tp.edit(searchConfig=[{'id': 'col_a', 'label': '', 'description': '', 'additionalConfiguration': []}])
        self.storage.add({'__creator__': 'user1', 'col_a': 'Foo Bar Baz', '__uuid__': 'aaa'})
        self.tp_catalog.addIndex('col_a', 'FieldIndex')
        self.tp_catalog.clearFindAndRebuild()
        request.form['col_a'] = 'Foo Bar Baz'
        output = tp()
        self.assertTrue('<select name="col_a:list"' in output)
        self.assertTrue('<option value="Foo Bar Baz" selected="selected">' in output)

    def test_search_form_postback2(self):
        portal = self.layer['portal']
        request = self.layer['request']
        tp = portal.table_page
        tp.edit(searchConfig=[{'id': 'col_a', 'label': '', 'description': '', 'additionalConfiguration': []}])
        self.storage.add({'__creator__': 'user1', 'col_a': 'Foo Bar Baz', '__uuid__': 'aaa'})
        self.tp_catalog.addIndex('col_a', 'ZCTextIndex', self.index_args('col_a'))
        self.tp_catalog.clearFindAndRebuild()
        request.form['col_a'] = 'Foo Bar Baz'
        output = tp()
        self.assertTrue('<input type="text" name="col_a" id="search_col_a" value="Foo Bar Baz" />' in output)

    def test_search_simple_filter(self):
        portal = self.layer['portal']
        request = self.layer['request']
        tp = portal.table_page
        tp.edit(searchConfig=[{'id': 'col_a', 'label': '', 'description': '', 'additionalConfiguration': []}])
        self.storage.add({'__creator__': 'user1', 'col_a': 'Foo Bar Baz', '__uuid__': 'aaa'})
        self.storage.add({'__creator__': 'user1', 'col_a': 'Qux Tux', '__uuid__': 'bbb'})
        self.tp_catalog.addIndex('col_a', 'FieldIndex')
        self.tp_catalog.clearFindAndRebuild()
        request.form['col_a'] = 'Foo Bar Baz'
        request.form['searchInTable'] = '1'
        pq = PyQuery(tp())
        table = pq('table.tablePage').text()
        self.assertTrue('Foo Bar Baz' in table)
        self.assertFalse('Qux Tux' in table)

    def test_search_text_filter(self):
        portal = self.layer['portal']
        request = self.layer['request']
        tp = portal.table_page
        tp.edit(searchConfig=[{'id': 'col_a', 'label': '', 'description': '', 'additionalConfiguration': []}])
        self.storage.add({'__creator__': 'user1', 'col_a': 'Foo Bar Baz', '__uuid__': 'aaa'})
        self.storage.add({'__creator__': 'user1', 'col_a': 'Qux Bar Tux', '__uuid__': 'bbb'})
        self.storage.add({'__creator__': 'user1', 'col_a': 'XXX YYY', '__uuid__': 'ccc'})
        self.tp_catalog.addIndex('col_a', 'ZCTextIndex', self.index_args('col_a'))
        self.tp_catalog.clearFindAndRebuild()
        request.form['col_a'] = 'Bar'
        request.form['searchInTable'] = '1'
        pq = PyQuery(tp())
        table = pq('table.tablePage').text()
        self.assertTrue('Foo Bar Baz' in table)
        self.assertTrue('Qux Bar Tux' in table)
        self.assertFalse('XXX YYY' in table)

    def test_fulltext_search(self):
        portal = self.layer['portal']
        request = self.layer['request']
        tp = portal.table_page
        tp.edit(searchConfig=[{'id': 'col_a', 'label': '', 'description': '', 'additionalConfiguration': ['SearchableText']},
                              {'id': 'col_b', 'label': '', 'description': '', 'additionalConfiguration': ['SearchableText']},
                              ])
        self.storage.add({'col_a': 'Foo Bar Baz', 'col_b': 'Foo Dom', '__uuid__': 'aaa'})
        self.storage.add({'col_a': 'Qux Bar Tux', 'col_b': 'FooFoo', '__uuid__': 'bbb'})
        self.tp_catalog.clearFindAndRebuild()
        request.form['SearchableText'] = 'Foo*'
        request.form['searchInTable'] = '1'
        pq = PyQuery(tp())
        table = pq('table.tablePage').text()
        self.assertTrue('Foo Dom' in table)
        self.assertTrue('FooFoo' in table)

    def test_fulltext_search_skip_col(self):
        portal = self.layer['portal']
        request = self.layer['request']
        tp = portal.table_page
        tp.edit(searchConfig=[{'id': 'col_a', 'label': '', 'description': '', 'additionalConfiguration': ['SearchableText']},
                              {'id': 'col_b', 'label': '', 'description': '', 'additionalConfiguration': ['']},
                              ])
        self.storage.add({'col_a': 'Foo Bar', 'col_b': 'Baz Qux', '__uuid__': 'aaa'})
        self.storage.add({'col_a': 'Qux Tux', 'col_b': 'Bar', '__uuid__': 'bbb'})
        self.tp_catalog.clearFindAndRebuild()
        request.form['SearchableText'] = 'Bar*'
        request.form['searchInTable'] = '1'
        pq = PyQuery(tp())
        table = pq('table.tablePage').text()
        self.assertTrue('Foo Bar' in table)
        self.assertFalse('Qux Tux' in table)