[7195] | 1 | ## $Id: test_workflow.py 7811 2012-03-08 19:00:51Z uli $ |
---|
| 2 | ## |
---|
| 3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
| 4 | ## This program is free software; you can redistribute it and/or modify |
---|
| 5 | ## it under the terms of the GNU General Public License as published by |
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | ## (at your option) any later version. |
---|
| 8 | ## |
---|
| 9 | ## This program is distributed in the hope that it will be useful, |
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | ## GNU General Public License for more details. |
---|
| 13 | ## |
---|
| 14 | ## You should have received a copy of the GNU General Public License |
---|
| 15 | ## along with this program; if not, write to the Free Software |
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | ## |
---|
[6546] | 18 | import shutil |
---|
| 19 | import tempfile |
---|
[7811] | 20 | from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase |
---|
| 21 | from waeup.kofa.accesscodes.workflow import ( |
---|
[6546] | 22 | invalidate_action, disable_used_action, disable_unused_action, |
---|
| 23 | reenable_action, |
---|
| 24 | ) |
---|
| 25 | |
---|
| 26 | class WorkflowActionsTests(FunctionalTestCase): |
---|
| 27 | # Tests for helpers like get_access_code, disable_accesscode, ... |
---|
| 28 | |
---|
| 29 | layer = FunctionalLayer |
---|
| 30 | |
---|
| 31 | def setUp(self): |
---|
| 32 | super(WorkflowActionsTests, self).setUp() |
---|
| 33 | self.workdir = tempfile.mkdtemp() |
---|
| 34 | |
---|
| 35 | def tearDown(self): |
---|
| 36 | shutil.rmtree(self.workdir) |
---|
| 37 | super(WorkflowActionsTests, self).tearDown() |
---|
| 38 | return |
---|
| 39 | |
---|
| 40 | def test_actions_wo_parents(self): |
---|
| 41 | # We can pass contexts without parent to actions |
---|
| 42 | context = object() # Some fake context without parent |
---|
| 43 | self.assertTrue(invalidate_action(None, context) is None) |
---|
| 44 | self.assertTrue(disable_used_action(None, context) is None) |
---|
| 45 | self.assertTrue(disable_unused_action(None, context) is None) |
---|
| 46 | self.assertTrue(reenable_action(None, context) is None) |
---|
| 47 | return |
---|