def test_create_tool_analysis(self): with mock.patch("tool_manager.utils.create_tool_analysis" ) as create_tool_analysis_mock: create_analysis({ "name": "Valid Tool Analysis Config", "studyUuid": self.study.uuid, "toolUuid": str(uuid.uuid4()), "user_id": self.user.id, "workflowUuid": self.workflow.uuid }) self.assertTrue(create_tool_analysis_mock.called)
def test_create_noderelationship_analysis(self): with mock.patch( "analysis_manager.utils.create_noderelationship_analysis" ) as create_noderelationship_analysis_mock: create_analysis({ "name": "Valid NodeRelationship Analysis Config", "studyUuid": self.study.uuid, "nodeRelationshipUuid": str(uuid.uuid4()), "user_id": self.user.id, "workflowUuid": self.workflow.uuid }) self.assertTrue(create_noderelationship_analysis_mock.called)
def _create_analysis(self): """Create the Analysis instance for our WorkflowTool's launch()""" analysis_config = self._get_analysis_config() validate_analysis_config(analysis_config) analysis = create_analysis(analysis_config) self.set_analysis(analysis.uuid) workflow_dict = self._get_workflow_dict() self.analysis.workflow_copy = workflow_dict self.analysis.workflow_steps_num = len(workflow_dict["steps"].keys()) self.analysis.save() AnalysisStatus.objects.create(analysis=analysis) return analysis
def test_create_nodeset_analysis_without_user_provided_name( self, get_solr_uuids_mock, workflow_inputs_mock): name = "" with mock.patch("analysis_manager.utils._fetch_node_set" ) as create_noderelationship_analysis_mock: analysis = create_analysis({ "name": name, "studyUuid": self.study.uuid, "nodeSetUuid": str(uuid.uuid4()), "user_id": self.user.id, "workflowUuid": self.workflow.uuid }) self.assertTrue(create_noderelationship_analysis_mock.called) self.assertNotEqual(analysis.name, name) self.assertTrue(get_solr_uuids_mock.called) self.assertTrue(workflow_inputs_mock.called)
def test_create_noderelationship_analysis_with_user_provided_name(self): name = "This is a user provided name" with mock.patch( "analysis_manager.utils._fetch_node_relationship" ) as create_noderelationship_analysis_mock: analysis = create_analysis( { "name": name, "studyUuid": self.study.uuid, "nodeRelationshipUuid": str(uuid.uuid4()), "user_id": self.user.id, "workflowUuid": self.workflow.uuid } ) self.assertTrue(create_noderelationship_analysis_mock.called) self.assertEqual(analysis.name, name)