Files
tryton/trytond/tests/test_workflow.py
T

33 lines
978 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
from trytond.transaction import Transaction
from trytond.tests.test_tryton import (POOL, DB_NAME, USER, CONTEXT,
install_module)
class WorkflowTestCase(unittest.TestCase):
def setUp(self):
2013-09-16 11:38:11 +02:00
install_module('tests')
2012-09-24 22:16:53 +02:00
self.workflow = POOL.get('test.workflowed')
2012-03-25 00:15:17 +01:00
# TODO add test for Workflow.transition
def test0010transition(self):
'Test transition'
with Transaction().start(DB_NAME, USER, context=CONTEXT):
2013-01-06 22:18:13 +01:00
wkf, = self.workflow.create([{}])
2012-09-24 22:16:53 +02:00
self.workflow.run([wkf])
self.assertEqual(wkf.state, 'running')
2012-09-24 22:16:53 +02:00
wkf.state = 'end'
wkf.save()
self.workflow.run([wkf])
self.assertEqual(wkf.state, 'end')
def suite():
return unittest.TestLoader().loadTestsFromTestCase(WorkflowTestCase)