Projet

Général

Profil

0001-workflows-don-t-include-dispatch-rules-in-export-of-.patch

Frédéric Péters, 03 juin 2019 22:00

Télécharger (1,77 ko)

Voir les différences:

Subject: [PATCH] workflows: don't include dispatch rules in export of manual
 dispatch (#33634)

 tests/test_workflow_import.py | 7 +++++++
 wcs/wf/dispatch.py            | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)
tests/test_workflow_import.py
501 501
            {'value': 'a', 'role_id': role3.id}, {'value': 'b', 'role_id': role4.id}]
502 502
    assert wf2.possible_status[0].items[0].dispatch_type == 'automatic'
503 503

  
504
    # check rules are not exported with dispatch type is not automatic
505
    dispatch.dispatch_type = 'manual'
506
    wf2 = assert_import_export_works(wf)
507
    assert wf2.possible_status[0].items[0].dispatch_type == 'manual'
508
    assert not wf2.possible_status[0].items[0].rules
509
    xml_export = export_to_indented_xml(wf, include_id=True)
510
    assert xml_export.find('possible_status/status/items/item/rules') is None
504 511

  
505 512
def test_display_message_action(pub):
506 513
    wf = Workflow(name='status')
wcs/wf/dispatch.py
101 101
                include_id=include_id)
102 102

  
103 103
    def rules_export_to_xml(self, item, charset, include_id=False):
104
        if not self.rules:
104
        if self.dispatch_type != 'automatic' or not self.rules:
105 105
            return
106 106

  
107 107
        rules_node = ET.SubElement(item, 'rules')
108
-