Files
tryton/trytond/tests/test_order.py
T
2021-12-11 17:58:45 +01:00

40 lines
1.0 KiB
Python

# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import unittest
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
class SequenceOrderedMixinTestCase(unittest.TestCase):
'Test SequenceOrderedMixin'
@classmethod
def setUpClass(cls):
activate_module('tests')
@with_transaction()
def test_order(self):
'Test order'
pool = Pool()
Order = pool.get('test.order.sequence')
models = []
for i in reversed(list(range(1, 4))):
models.append(Order(sequence=i))
Order.save(models)
models.reverse()
self.assertListEqual(Order.search([]), models)
model = models.pop()
model.sequence = None
model.save()
models.insert(0, model)
self.assertListEqual(Order.search([]), models)
def suite():
return unittest.TestLoader().loadTestsFromTestCase(
SequenceOrderedMixinTestCase)