summaryrefslogtreecommitdiff
path: root/ishtar_common/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r--ishtar_common/tests.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index 174918dd4..536d6d4a8 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -129,15 +129,45 @@ class WizardTestFormData(object):
accepting two parameters: the current test object and the final step
response
"""
+ self.name = name
self.form_datas = form_datas
self.ignored = ignored[:]
self.pre_tests = pre_tests
self.extra_tests = extra_tests
+ def set(self, form_name, field_name, value):
+ """
+ Set data value.
+
+ :param form_name: form name without wizard name
+ :param field_name: field name
+ :param value: value
+ :return: None
+ """
+ self.form_datas[form_name][field_name] = value
+
+ def append(self, form_name, value):
+ """
+ Add data value to formset.
+
+ :param form_name: form name without wizard name
+ :param value: value
+ :return: None
+ """
+ self.form_datas[form_name].append(value)
+
def inits(self, test_object):
"""
Initialisations before the wizard.
"""
+
+ suffix = '-' + test_object.url_name
+ # if form names are defined without url_name fix it
+ for form_name in self.form_datas.keys():
+ if suffix in form_name:
+ continue
+ self.form_datas[form_name + suffix] = self.form_datas.pop(form_name)
+
for pre in self.pre_tests:
pre(test_object)