Commit ff87a1d1 authored by Vincent Pelletier's avatar Vincent Pelletier

Add test for fulltext operator-generated ORDER BY expression.

Fulltext operator (MatchComparisonOperator) is special because it generates
ORDER BY expression, which is to be used only if caller tells catalog to sort
on the fulltext column. This code tests just that.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33661 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 450b448a
...@@ -551,6 +551,15 @@ class TestSQLCatalog(unittest.TestCase): ...@@ -551,6 +551,15 @@ class TestSQLCatalog(unittest.TestCase):
self.assertTrue(self._catalog.hasColumn('uid')) self.assertTrue(self._catalog.hasColumn('uid'))
self.assertFalse(self._catalog.hasColumn('foobar')) self.assertFalse(self._catalog.hasColumn('foobar'))
def test_fulltextOrderBy(self):
# No order_by_list, resulting "ORDER BY" must be empty.
sql_expression = self.asSQLExpression({'fulltext': 'foo'})
self.assertEqual(sql_expression.getOrderByExpression(), '')
# order_by_list on fulltext column, resulting "ORDER BY" must be non-empty.
sql_expression = self.asSQLExpression({'fulltext': 'foo',
'order_by_list': [('fulltext', ), ]})
self.assertNotEqual(sql_expression.getOrderByExpression(), '')
##return catalog(title=Query(title='a', operator='not')) ##return catalog(title=Query(title='a', operator='not'))
#return catalog(title={'query': 'a', 'operator': 'not'}) #return catalog(title={'query': 'a', 'operator': 'not'})
#return catalog(title={'query': ['a', 'b'], 'operator': 'not'}) #return catalog(title={'query': ['a', 'b'], 'operator': 'not'})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment