0001-backoffice-format-conditions-in-workflow-inspect-vie.patch
tests/admin_pages/test_workflow.py | ||
---|---|---|
2755 | 2755 |
jump.id = '_jump' |
2756 | 2756 |
jump.timeout = 86400 |
2757 | 2757 |
jump.status = foo_status.id |
2758 |
jump.condition = {'type': 'django', 'value': '1 == 1'} |
|
2758 | 2759 |
baz_status.items.append(jump) |
2759 | 2760 |
jump.parent = baz_status |
2760 | 2761 | |
2761 | 2762 |
invalid_jump = JumpWorkflowStatusItem() |
2762 | 2763 |
invalid_jump.id = '_invalid_jump' |
2763 | 2764 |
invalid_jump.status = 'xxx' |
2765 |
invalid_jump.condition = {'type': 'python', 'value': '0 == 0'} |
|
2764 | 2766 |
baz_status.items.append(invalid_jump) |
2765 | 2767 |
invalid_jump.parent = baz_status |
2766 | 2768 | |
... | ... | |
2791 | 2793 |
'<li><span class="parameter">Dispatch Type:</span> Simple</li>' |
2792 | 2794 |
'<li><span class="parameter">Role:</span> foobar</li>' |
2793 | 2795 |
) in resp.text |
2796 |
assert '<tt>1 == 1</tt>' in resp.text |
|
2797 |
assert '<tt>0 == 0</tt> (Python)' in resp.text |
|
2794 | 2798 | |
2795 | 2799 | |
2796 | 2800 |
def test_workflows_unused(pub): |
wcs/workflows.py | ||
---|---|---|
2199 | 2199 |
else: |
2200 | 2200 |
return str(value) |
2201 | 2201 | |
2202 |
def get_condition_parameter_view_value(self): |
|
2203 |
value = self.condition |
|
2204 |
if value and value.get('type') == 'django': |
|
2205 |
return htmltext('<tt>%s</tt>') % value.get('value') |
|
2206 |
elif value and value.get('type') == 'python': |
|
2207 |
return htmltext('<tt>%s</tt> (%s)') % (value.get('value'), _('Python')) |
|
2208 | ||
2202 | 2209 |
def fill_admin_form(self, form): |
2203 | 2210 |
for parameter in self.get_parameters(): |
2204 | 2211 |
self.add_parameters_widgets(form, [parameter]) |
2205 |
- |