[ADD]Yaltik DSL : tests for yes_no filter
This commit is contained in:
parent
fd014bf3b3
commit
d401fec32c
@ -114,6 +114,33 @@ class TestOdooBase(unittest.TestCase):
|
||||
self.assertEqual(element.attrs['type'], 'xml')
|
||||
self.assertFalse(element.children)
|
||||
|
||||
def test_filter_yes_no(self):
|
||||
""" Test Filter Yes No """
|
||||
elements = od.filter_yes_no('some_field')
|
||||
self.assertIsInstance(elements, list)
|
||||
self.assertFalse(elements)
|
||||
|
||||
elements = od.filter_yes_no('some_field', 'Some field')
|
||||
self.assertEqual(len(elements), 1)
|
||||
self.assertIsInstance(elements[0], XMLDictElement)
|
||||
self.assertEqual(elements[0].tag, 'filter')
|
||||
self.assertEqual(elements[0].attrs['name'], 'some_field_yes')
|
||||
self.assertEqual(elements[0].attrs['string'], 'Some field')
|
||||
self.assertEqual(elements[0].attrs['domain'], "[('some_field', '=', True)]")
|
||||
|
||||
elements = od.filter_yes_no('some_field', 'Some field', 'Not some field')
|
||||
self.assertEqual(len(elements), 2)
|
||||
self.assertIsInstance(elements[0], XMLDictElement)
|
||||
self.assertEqual(elements[0].tag, 'filter')
|
||||
self.assertEqual(elements[0].attrs['name'], 'some_field_yes')
|
||||
self.assertEqual(elements[0].attrs['string'], 'Some field')
|
||||
self.assertEqual(elements[0].attrs['domain'], "[('some_field', '=', True)]")
|
||||
self.assertIsInstance(elements[1], XMLDictElement)
|
||||
self.assertEqual(elements[1].tag, 'filter')
|
||||
self.assertEqual(elements[1].attrs['name'], 'some_field_no')
|
||||
self.assertEqual(elements[1].attrs['string'], 'Not some field')
|
||||
self.assertEqual(elements[1].attrs['domain'], "[('some_field', '=', False)]")
|
||||
|
||||
def test_view(self):
|
||||
""" Test view function """
|
||||
element = od.view('view_xmlid', [])
|
||||
|
Loading…
Reference in New Issue
Block a user