def test__inherit_relationship(self, mocker, job_template_nodes, job_nodes, job_nodes_dict):
            wj = WorkflowJob()

            node_ids_map = wj._create_workflow_nodes(job_template_nodes)
            wj._inherit_node_relationships(job_template_nodes, node_ids_map)

            for i in range(0, 8):
                node_ids_map[i].success_nodes.add.assert_any_call(node_ids_map[i + 1])
Example #2
0
        def test__create_workflow_job_nodes(self, mocker, job_template_nodes):
            workflow_job_node_create = mocker.patch(
                'awx.main.models.WorkflowJobTemplateNode.create_workflow_job_node'
            )

            workflow_job = WorkflowJob()
            workflow_job._create_workflow_nodes(job_template_nodes)

            for job_template_node in job_template_nodes:
                workflow_job_node_create.assert_any_call(
                    workflow_job=workflow_job)
        def test__map_workflow_job_nodes(self, job_template_nodes, job_nodes, mocker):
            mixin = WorkflowJob()
            wj_node = WorkflowJobNode()
            mocker.patch('awx.main.models.workflow.WorkflowJobTemplateNode.create_workflow_job_node',
                         return_value=wj_node)

            node_ids_map = mixin._create_workflow_nodes(job_template_nodes, user=None)
            assert len(node_ids_map) == len(job_template_nodes)

            for i, job_template_node in enumerate(job_template_nodes):
                assert node_ids_map[job_template_node.id] == wj_node
Example #4
0
def workflow_job_unit():
    return WorkflowJob(name='workflow', status='new')