api: fix scanning deps of manual/unconfigured dispatch action (#68166)

This commit is contained in:
Frédéric Péters 2022-08-15 18:03:35 +02:00
parent 94a5343bd7
commit 49b76c01cf
2 changed files with 8 additions and 2 deletions

View File

@ -127,6 +127,11 @@ def test_export_import_dependencies(pub):
send_mail = status.add_action('sendmail')
send_mail.to = [role.id]
dispatch_auto = status.add_action('dispatch')
dispatch_auto.rules = [{'role_id': role.id, 'value': 'xxx'}]
status.add_action('dispatch') # unconfigured/manual dispatch
workflow.store()
formdef.fields = [
@ -179,7 +184,8 @@ def test_export_import_dependencies(pub):
mail_template.store()
resp = get_app(pub).get(sign_uri('/api/export-import/workflows/'))
resp = get_app(pub).get(sign_uri(resp.json['data'][0]['urls']['dependencies']))
resp = get_app(pub).get(sign_uri(resp.json['data'][-1]['urls']['dependencies']))
mail_template_entry = [x for x in resp.json['data'] if x['type'] == 'mail-templates'][0]
resp = get_app(pub).get(sign_uri(mail_template_entry['urls']['dependencies']))
assert {(x['id'], x['type']) for x in resp.json['data']} == {('cat', 'mail-templates-categories')}
for dependency in resp.json['data']:
get_app(pub).get(sign_uri(dependency['urls']['export']))

View File

@ -144,7 +144,7 @@ class DispatchWorkflowStatusItem(WorkflowStatusItem):
def get_dependencies(self):
yield from get_role_dependencies([self.role_id])
yield from get_role_dependencies([x.get('role_id') for x in self.rules])
yield from get_role_dependencies([x.get('role_id') for x in self.rules or []])
def get_line_details(self):
if self.role_key: