Files
tryton/trytond/tests/test_workflow.py
T

35 lines
905 B
Python
Raw Normal View History

# 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
2016-02-06 19:10:35 +01:00
from trytond.tests.test_tryton import install_module, with_transaction
from trytond.pool import Pool
class WorkflowTestCase(unittest.TestCase):
2016-02-06 19:10:35 +01:00
@classmethod
def setUpClass(cls):
2013-09-16 11:38:11 +02:00
install_module('tests')
2012-03-25 00:15:17 +01:00
# TODO add test for Workflow.transition
2016-02-06 19:10:35 +01:00
@with_transaction()
def test_transition(self):
2012-03-25 00:15:17 +01:00
'Test transition'
2016-02-06 19:10:35 +01:00
pool = Pool()
Workflowed = pool.get('test.workflowed')
2016-02-06 19:10:35 +01:00
wkf, = Workflowed.create([{}])
2016-02-06 19:10:35 +01:00
Workflowed.run([wkf])
self.assertEqual(wkf.state, 'running')
wkf.state = 'end'
wkf.save()
Workflowed.run([wkf])
self.assertEqual(wkf.state, 'end')
def suite():
return unittest.TestLoader().loadTestsFromTestCase(WorkflowTestCase)