diff --git a/forms-flow-api/src/formsflow_api/services/form_process_mapper.py b/forms-flow-api/src/formsflow_api/services/form_process_mapper.py index 48d763e886..4ca3ae4d93 100644 --- a/forms-flow-api/src/formsflow_api/services/form_process_mapper.py +++ b/forms-flow-api/src/formsflow_api/services/form_process_mapper.py @@ -497,18 +497,20 @@ def export( # pylint:disable=too-many-locals workflows.append(workflow) authorizations.append(self._get_authorizations(mapper.form_id, user)) - forms_names, dmns, sub_workflows = self._parse_xml( - workflow["content"], user - ) - - for form in set(forms_names): - forms.append( - self._get_form(form, "sub", form_id=None, description=None, tenant_key=tenant_key) - ) - for dmn in set(dmns): - rules.append(self._get_dmn(dmn, "sub", user)) - - workflows.extend(sub_workflows) + # Parse bpm xml to get subforms & workflows + # The following lines are currently commented out but may be needed for future use. + # forms_names, dmns, sub_workflows = self._parse_xml( + # workflow["content"], user + # ) + + # for form in set(forms_names): + # forms.append( + # self._get_form(form, "sub", form_id=None, description=None, tenant_key=tenant_key) + # ) + # for dmn in set(dmns): + # rules.append(self._get_dmn(dmn, "sub", user)) + + # workflows.extend(sub_workflows) return { "forms": forms, diff --git a/forms-flow-api/tests/unit/api/test_form_process_mapper.py b/forms-flow-api/tests/unit/api/test_form_process_mapper.py index 8f89c37671..1cf5a19c1e 100644 --- a/forms-flow-api/tests/unit/api/test_form_process_mapper.py +++ b/forms-flow-api/tests/unit/api/test_form_process_mapper.py @@ -443,85 +443,85 @@ def test_export(app, client, session, jwt, mock_redis_client): assert len(response.json["authorizations"]) == 1 # Test export - with task based forms - no DMN - no subprocess - form = FormProcessMapper( - **mapper_payload("sample form2", "formconectflow", "FormConnectFlow") - ) - form.save() - mapper_id = form.id - form_id = form.form_id - - # Mock response - mock_response = MagicMock() - mock_response.status_code = 200 - mock_response.json = { - "forms": [get_forms("sample form2", "main"), get_forms("sample form3", "sub")], - "workflows": [ - get_workflows("formconectflow", "FormConnectFlow", "main", "xml") - ], - "rules": [], - "authorizations": [get_authorizations(form_id)], - } - client.get.return_value = mock_response - response = get_export(client, headers, mapper_id) - assert response.status_code == 200 - assert response.json is not None - assert len(response.json["forms"]) == 2 - assert len(response.json["workflows"]) == 1 - assert len(response.json["rules"]) == 0 - assert len(response.json["authorizations"]) == 1 + # form = FormProcessMapper( + # **mapper_payload("sample form2", "formconectflow", "FormConnectFlow") + # ) + # form.save() + # mapper_id = form.id + # form_id = form.form_id + + # # Mock response + # mock_response = MagicMock() + # mock_response.status_code = 200 + # mock_response.json = { + # "forms": [get_forms("sample form2", "main"), get_forms("sample form3", "sub")], + # "workflows": [ + # get_workflows("formconectflow", "FormConnectFlow", "main", "xml") + # ], + # "rules": [], + # "authorizations": [get_authorizations(form_id)], + # } + # client.get.return_value = mock_response + # response = get_export(client, headers, mapper_id) + # assert response.status_code == 200 + # assert response.json is not None + # assert len(response.json["forms"]) == 2 + # assert len(response.json["workflows"]) == 1 + # assert len(response.json["rules"]) == 0 + # assert len(response.json["authorizations"]) == 1 # Test export - with DMN- no task based forms - no subprocess - form = FormProcessMapper( - **mapper_payload("sample form2", "rulebasedflow", "RuleBasedFlow") - ) - form.save() - mapper_id = form.id - form_id = form.form_id - - # Mock response - mock_response = MagicMock() - mock_response.status_code = 200 - mock_response.json = { - "forms": [get_forms("sample form2", "main")], - "workflows": [get_workflows("rulebasedflow", "RuleBasedFlow", "main", "xml")], - "rules": [get_dmns("dmn1", "main", "dmn xml")], - "authorizations": [get_authorizations(form_id)], - } - client.get.return_value = mock_response - response = get_export(client, headers, mapper_id) - assert response.status_code == 200 - assert response.json is not None - assert len(response.json["forms"]) == 1 - assert len(response.json["workflows"]) == 1 - assert len(response.json["rules"]) == 1 - assert len(response.json["authorizations"]) == 1 + # form = FormProcessMapper( + # **mapper_payload("sample form2", "rulebasedflow", "RuleBasedFlow") + # ) + # form.save() + # mapper_id = form.id + # form_id = form.form_id + + # # Mock response + # mock_response = MagicMock() + # mock_response.status_code = 200 + # mock_response.json = { + # "forms": [get_forms("sample form2", "main")], + # "workflows": [get_workflows("rulebasedflow", "RuleBasedFlow", "main", "xml")], + # "rules": [get_dmns("dmn1", "main", "dmn xml")], + # "authorizations": [get_authorizations(form_id)], + # } + # client.get.return_value = mock_response + # response = get_export(client, headers, mapper_id) + # assert response.status_code == 200 + # assert response.json is not None + # assert len(response.json["forms"]) == 1 + # assert len(response.json["workflows"]) == 1 + # assert len(response.json["rules"]) == 1 + # assert len(response.json["authorizations"]) == 1 # Test export - with subprocess - no DMN- no task based forms - form = FormProcessMapper( - **mapper_payload("sample form2", "subprocessflow", "SubprocessFlow") - ) - form.save() - mapper_id = form.id - form_id = form.form_id - - # Mock response - mock_response = MagicMock() - mock_response.status_code = 200 - mock_response.json = { - "forms": [get_forms("sample form2", "main")], - "workflows": [ - get_workflows("subprocessflow", "SubprocessFlow", "main", "xml"), - get_workflows("subflow1", "subflow1", "sub", "xml"), - get_workflows("subflow2", "subflow2", "sub", "xml"), - ], - "rules": [], - "authorizations": [get_authorizations(form_id)], - } - client.get.return_value = mock_response - response = get_export(client, headers, mapper_id) - assert response.status_code == 200 - assert response.json is not None - assert len(response.json["forms"]) == 1 - assert len(response.json["workflows"]) == 3 - assert len(response.json["rules"]) == 0 - assert len(response.json["authorizations"]) == 1 + # form = FormProcessMapper( + # **mapper_payload("sample form2", "subprocessflow", "SubprocessFlow") + # ) + # form.save() + # mapper_id = form.id + # form_id = form.form_id + + # # Mock response + # mock_response = MagicMock() + # mock_response.status_code = 200 + # mock_response.json = { + # "forms": [get_forms("sample form2", "main")], + # "workflows": [ + # get_workflows("subprocessflow", "SubprocessFlow", "main", "xml"), + # get_workflows("subflow1", "subflow1", "sub", "xml"), + # get_workflows("subflow2", "subflow2", "sub", "xml"), + # ], + # "rules": [], + # "authorizations": [get_authorizations(form_id)], + # } + # client.get.return_value = mock_response + # response = get_export(client, headers, mapper_id) + # assert response.status_code == 200 + # assert response.json is not None + # assert len(response.json["forms"]) == 1 + # assert len(response.json["workflows"]) == 3 + # assert len(response.json["rules"]) == 0 + # assert len(response.json["authorizations"]) == 1