Commit c6510189 authored by Vincent Pelletier's avatar Vincent Pelletier

Split test_001_DefaultKey, test_003_DateTimeKey and test_004_KeywordKey into 2...

Split test_001_DefaultKey, test_003_DateTimeKey and test_004_KeywordKey into 2 tests each, instead of using a 2-items loop in each.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25837 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 372c7949
......@@ -166,8 +166,7 @@ class TestSQLCatalog(unittest.TestCase):
'Query: %r\nSearchText: %r\nReference: %r\nSecond rendering: %r' % \
(query, search_text, reference_param_dict, search_text_param_dict))
def test_001_DefaultKey(self):
for column in ('default', 'related_default'):
def _testDefaultKey(self, column):
self.catalog(ReferenceQuery(ReferenceQuery(operator='=', default='a'), operator='and'),
{column: 'a'})
self.catalog(ReferenceQuery(ReferenceQuery(operator='like', default='%a'), operator='and'),
......@@ -205,6 +204,12 @@ class TestSQLCatalog(unittest.TestCase):
self.catalog(ReferenceQuery(ReferenceQuery(operator='in', default=['a', 'b']), operator='and'),
{column: ['=a', '=b']})
def test_DefaultKey(self):
self._testDefaultKey('default')
def test_relatedDefaultKey(self):
self._testDefaultKey('related_default')
def test_002_keyOverride(self):
self.catalog(ReferenceQuery(ReferenceQuery(operator='=', default='%a'), operator='and'),
{'default': {'query': '%a', 'key': 'ExactMatch'}},
......@@ -213,8 +218,7 @@ class TestSQLCatalog(unittest.TestCase):
{'default': {'query': '<a', 'key': 'ExactMatch'}},
check_search_text=False)
def test_003_DateTimeKey(self):
for column in ('date', 'related_date'):
def _testDateTimeKey(self, column):
self.catalog(ReferenceQuery(ReferenceQuery(operator='>=', date=DateTime('2008/10/01 12:10:21')), operator='and'),
{column: {'query': '>2008/10/01 12:10:20', 'format': '%y/%m/%d'}})
self.catalog(ReferenceQuery(ReferenceQuery(operator='>=', date=DateTime('2008/10/01 12:10:21 CEST')), operator='and'),
......@@ -283,8 +287,13 @@ class TestSQLCatalog(unittest.TestCase):
, operator='and'), operator='and'),
{column: '2008/02/02 10:10:10 UTC'})
def test_004_KeywordKey(self):
for column in ('keyword', 'related_keyword'):
def test_DateTimeKey(self):
self._testDateTimeKey('date')
def test_relatedDateTimeKey(self):
self._testDateTimeKey('related_date')
def _testKeywordKey(self, column):
self.catalog(ReferenceQuery(ReferenceQuery(operator='like', keyword='%a%'), operator='and'),
{column: 'a'})
self.catalog(ReferenceQuery(ReferenceQuery(operator='like', keyword='%a b%'), operator='and'),
......@@ -319,6 +328,12 @@ class TestSQLCatalog(unittest.TestCase):
, operator='or'), operator='and'),
{column: ['a', '%b']})
def test_KeywordKey(self):
self._testKeywordKey('keyword')
def test_relatedKeywordKey(self):
self._testKeywordKey('related_keyword')
def test_005_SearchText(self):
self.catalog(ReferenceQuery(ReferenceQuery(ReferenceQuery(operator='like', keyword='%=a%'), ReferenceQuery(operator='like', keyword='%=b%'), operator='or'), operator='and'),
{'keyword': '"=a" OR "=b"'})
......
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