def test_cascading_deletion_of_analyses(self, total_analyses=5): """Delete a Dataset and make sure its Analyses are removed from the UI as well""" # Create sample Data make_analyses_with_single_dataset(total_analyses, self.user) wait_until_id_clickable(self.browser, "total-datasets", MAX_WAIT) assert_text_within_id(self.browser, "total-datasets", MAX_WAIT, "{} data sets".format(1)) wait_until_id_clickable(self.browser, "total-analyses", MAX_WAIT) assert_text_within_id(self.browser, "total-analyses", MAX_WAIT, "{} analyses".format(total_analyses)) self.browser.find_elements_by_class_name('dataset-delete')[0].click() wait_until_id_clickable(self.browser, 'dataset-delete-button', MAX_WAIT).click() # Make sure that there are no more Analyses left after the One # Dataset is deleted wait_until_id_clickable(self.browser, "total-analyses", MAX_WAIT) assert_text_within_id(self.browser, "total-analyses", MAX_WAIT, "{} analysis".format(0)) wait_until_id_clickable(self.browser, "total-datasets", MAX_WAIT) assert_text_within_id(self.browser, "total-datasets", MAX_WAIT, "{} data sets".format(0))
def test_get_analysis(self): make_analyses_with_single_dataset(1, self.user) analysis = Analysis.objects.all()[0] node_with_analysis = Node.objects.create(assay=self.assay, study=self.study, analysis_uuid=analysis.uuid) self.assertEqual(node_with_analysis.get_analysis(), analysis)
def setUp(self): self.request_factory = RequestFactory() self.username = '******' self.password = '******' self.user = User.objects.create_user(self.username, '', self.password) self.user.id = 1 make_analyses_with_single_dataset(1, self.user) self.analysis = Analysis.objects.all()[0] self.view_root = "/analysis_manager/run/"
def setUp(self): self.username = '******' self.password = '******' self.user = User.objects.create_user(self.username, '', self.password) make_analyses_with_single_dataset(1, self.user) self.analysis = Analysis.objects.all()[0] self.analysis_status = AnalysisStatus.objects.create( analysis=self.analysis) self.dataset = DataSet.objects.all()[0]
def _create_analysis_node_connection(self, direction, is_refinery_file): user = User.objects.create_user("test", "", "test") make_analyses_with_single_dataset(1, user) AnalysisNodeConnection.objects.create( analysis=Analysis.objects.first(), node=self.node, direction=direction, step=1, name="{} Analysis Node Connection".format(direction), filename="test.txt", is_refinery_file=is_refinery_file)
def test_analysis_deletion(self, total_analyses=2): """Delete some analyses and make sure the UI updates properly""" # Create sample Data make_analyses_with_single_dataset(total_analyses, self.user) wait_until_id_visible(self.browser, "total-datasets", MAX_WAIT) assert_text_within_id(self.browser, "total-datasets", MAX_WAIT, "{} data sets".format(1)) assert_text_within_id(self.browser, "total-analyses", "{} analyses".format(total_analyses)) delete_from_ui(self.browser, "analysis", total_analyses)
def setUp(self): self.username = '******' self.password = '******' self.user = User.objects.create_user(self.username, '', self.password) analyses, self.dataset = make_analyses_with_single_dataset( 1, self.user) self.analysis = analyses[0] self.analysis_status = AnalysisStatus.objects.get( analysis=self.analysis)
def test_data_set_preview(self): """Test DataSet Preview""" # Create sample Data & refresh page make_analyses_with_single_dataset(5, self.user) wait_until_class_visible(self.browser, "title", MAX_WAIT) self.browser.find_elements_by_class_name("title")[0].click() search_array = [ "SUMMARY", "Description", "Number of files (total file size)", "Owner", "ANALYSES", "REFERENCES", "PROTOCOLS", ] for item in Analysis.objects.filter(name__startswith="Test Analysis"): search_array.append(item.name) assert_body_text(self.browser, search_array)
def test_that_analysis_404s_are_handled(self, total_analyses=5): """Test use case where Analysis objects are deleted (for example by an admin, or a user inbetween multiple windows) while a user is about to delete said object(s) themselves, User should receive a "Not Found" message""" # Create sample Data make_analyses_with_single_dataset(total_analyses, self.user) wait_until_id_clickable(self.browser, "total-datasets", MAX_WAIT) assert_text_within_id(self.browser, "total-datasets", MAX_WAIT, "{} data sets".format(1)) wait_until_id_clickable(self.browser, "total-analyses", MAX_WAIT) assert_text_within_id(self.browser, "total-analyses", MAX_WAIT, "{} analyses".format(total_analyses)) # Simulate scenario where objects have been deleted on the backend Analysis.objects.all().delete() self.browser.find_elements_by_class_name('analysis-delete')[0].click() wait_until_id_clickable(self.browser, 'analysis-delete-button', MAX_WAIT).click() wait_until_id_clickable(self.browser, "deletion-message-text", MAX_WAIT) assert_text_within_id(self.browser, "deletion-message-text", MAX_WAIT, "not found.") wait_until_id_clickable(self.browser, 'analysis-delete-close-button', 5).click() # Ensure that ui displays proper info wait_until_id_clickable(self.browser, "total-analyses", MAX_WAIT) assert_text_within_id(self.browser, "total-analyses", MAX_WAIT, "{} analysis".format(0)) wait_until_id_clickable(self.browser, "total-datasets", MAX_WAIT) assert_text_within_id(self.browser, "total-datasets", MAX_WAIT, "{} data sets".format(1))
def setUp(self): self.username = '******' self.password = '******' self.user = User.objects.create_user(self.username, '', self.password) analyses, self.dataset = make_analyses_with_single_dataset( 1, self.user ) self.analysis = analyses[0] self.analysis_status = AnalysisStatus.objects.get( analysis=self.analysis )