summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBarry Warsaw2016-11-24 11:47:54 -0500
committerBarry Warsaw2016-11-24 11:48:40 -0500
commit487da82226080986ec36bf09cee2f42ee79fc71c (patch)
tree38dc2efa7b4a6672d35acbe3879d2c43dd836fdd /src
parent71087d933ab55466237f4687243e866913c64ccf (diff)
downloadmailman-487da82226080986ec36bf09cee2f42ee79fc71c.tar.gz
mailman-487da82226080986ec36bf09cee2f42ee79fc71c.tar.zst
mailman-487da82226080986ec36bf09cee2f42ee79fc71c.zip
Diffstat (limited to 'src')
-rw-r--r--src/mailman/app/tests/test_workflow.py46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/mailman/app/tests/test_workflow.py b/src/mailman/app/tests/test_workflow.py
index 8ff4f34b9..98f47e036 100644
--- a/src/mailman/app/tests/test_workflow.py
+++ b/src/mailman/app/tests/test_workflow.py
@@ -50,6 +50,26 @@ class MyWorkflow(Workflow):
return 'three'
+class DependentWorkflow(MyWorkflow):
+ SAVE_ATTRIBUTES = ('ant', 'bee', 'cat', 'elf')
+
+ def __init__(self):
+ super().__init__()
+ self._elf = 5
+
+ @property
+ def elf(self):
+ return self._elf
+
+ @elf.setter
+ def elf(self, value):
+ # This attribute depends on other attributes.
+ assert self.ant is not None
+ assert self.bee is not None
+ assert self.cat is not None
+ self._elf = value
+
+
class TestWorkflow(unittest.TestCase):
layer = ConfigLayer
@@ -117,30 +137,10 @@ class TestWorkflow(unittest.TestCase):
def test_save_and_restore_dependant_attributes(self):
# Attributes must be restored in the order they are declared in
# SAVE_ATTRIBUTES.
-
- class DependantWorkflow(MyWorkflow):
- SAVE_ATTRIBUTES = ('ant', 'bee', 'cat', 'elf')
-
- def __init__(self):
- super().__init__()
- self._elf = 5
-
- @property
- def elf(self):
- return self._elf
-
- @elf.setter
- def elf(self, value):
- # This attribute depends on other attributes.
- assert self.ant is not None
- assert self.bee is not None
- assert self.cat is not None
- self._elf = value
-
- workflow = iter(DependantWorkflow())
+ workflow = iter(DependentWorkflow())
workflow.elf = 6
workflow.save()
- new_workflow = DependantWorkflow()
+ new_workflow = DependentWorkflow()
# The elf attribute must be restored last, set triggering values for
# attributes it depends on.
new_workflow.ant = new_workflow.bee = new_workflow.cat = None
@@ -160,7 +160,7 @@ class TestWorkflow(unittest.TestCase):
try:
new_workflow.restore()
except KeyError:
- self.fail("Restore does not handle obsolete attributes")
+ self.fail('Restore does not handle obsolete attributes')
# Restoring must not raise an exception, the default value is kept.
self.assertEqual(new_workflow.cat, 3)