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): ...@@ -166,8 +166,7 @@ class TestSQLCatalog(unittest.TestCase):
'Query: %r\nSearchText: %r\nReference: %r\nSecond rendering: %r' % \ 'Query: %r\nSearchText: %r\nReference: %r\nSecond rendering: %r' % \
(query, search_text, reference_param_dict, search_text_param_dict)) (query, search_text, reference_param_dict, search_text_param_dict))
def test_001_DefaultKey(self): def _testDefaultKey(self, column):
for column in ('default', 'related_default'):
self.catalog(ReferenceQuery(ReferenceQuery(operator='=', default='a'), operator='and'), self.catalog(ReferenceQuery(ReferenceQuery(operator='=', default='a'), operator='and'),
{column: 'a'}) {column: 'a'})
self.catalog(ReferenceQuery(ReferenceQuery(operator='like', default='%a'), operator='and'), self.catalog(ReferenceQuery(ReferenceQuery(operator='like', default='%a'), operator='and'),
...@@ -205,6 +204,12 @@ class TestSQLCatalog(unittest.TestCase): ...@@ -205,6 +204,12 @@ class TestSQLCatalog(unittest.TestCase):
self.catalog(ReferenceQuery(ReferenceQuery(operator='in', default=['a', 'b']), operator='and'), self.catalog(ReferenceQuery(ReferenceQuery(operator='in', default=['a', 'b']), operator='and'),
{column: ['=a', '=b']}) {column: ['=a', '=b']})
def test_DefaultKey(self):
self._testDefaultKey('default')
def test_relatedDefaultKey(self):
self._testDefaultKey('related_default')
def test_002_keyOverride(self): def test_002_keyOverride(self):
self.catalog(ReferenceQuery(ReferenceQuery(operator='=', default='%a'), operator='and'), self.catalog(ReferenceQuery(ReferenceQuery(operator='=', default='%a'), operator='and'),
{'default': {'query': '%a', 'key': 'ExactMatch'}}, {'default': {'query': '%a', 'key': 'ExactMatch'}},
...@@ -213,8 +218,7 @@ class TestSQLCatalog(unittest.TestCase): ...@@ -213,8 +218,7 @@ class TestSQLCatalog(unittest.TestCase):
{'default': {'query': '<a', 'key': 'ExactMatch'}}, {'default': {'query': '<a', 'key': 'ExactMatch'}},
check_search_text=False) check_search_text=False)
def test_003_DateTimeKey(self): def _testDateTimeKey(self, column):
for column in ('date', 'related_date'):
self.catalog(ReferenceQuery(ReferenceQuery(operator='>=', date=DateTime('2008/10/01 12:10:21')), operator='and'), 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'}}) {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'), self.catalog(ReferenceQuery(ReferenceQuery(operator='>=', date=DateTime('2008/10/01 12:10:21 CEST')), operator='and'),
...@@ -283,8 +287,13 @@ class TestSQLCatalog(unittest.TestCase): ...@@ -283,8 +287,13 @@ class TestSQLCatalog(unittest.TestCase):
, operator='and'), operator='and'), , operator='and'), operator='and'),
{column: '2008/02/02 10:10:10 UTC'}) {column: '2008/02/02 10:10:10 UTC'})
def test_004_KeywordKey(self): def test_DateTimeKey(self):
for column in ('keyword', 'related_keyword'): 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'), self.catalog(ReferenceQuery(ReferenceQuery(operator='like', keyword='%a%'), operator='and'),
{column: 'a'}) {column: 'a'})
self.catalog(ReferenceQuery(ReferenceQuery(operator='like', keyword='%a b%'), operator='and'), self.catalog(ReferenceQuery(ReferenceQuery(operator='like', keyword='%a b%'), operator='and'),
...@@ -319,6 +328,12 @@ class TestSQLCatalog(unittest.TestCase): ...@@ -319,6 +328,12 @@ class TestSQLCatalog(unittest.TestCase):
, operator='or'), operator='and'), , operator='or'), operator='and'),
{column: ['a', '%b']}) {column: ['a', '%b']})
def test_KeywordKey(self):
self._testKeywordKey('keyword')
def test_relatedKeywordKey(self):
self._testKeywordKey('related_keyword')
def test_005_SearchText(self): def test_005_SearchText(self):
self.catalog(ReferenceQuery(ReferenceQuery(ReferenceQuery(operator='like', keyword='%=a%'), ReferenceQuery(operator='like', keyword='%=b%'), operator='or'), operator='and'), self.catalog(ReferenceQuery(ReferenceQuery(ReferenceQuery(operator='like', keyword='%=a%'), ReferenceQuery(operator='like', keyword='%=b%'), operator='or'), operator='and'),
{'keyword': '"=a" OR "=b"'}) {'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