# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User rc # Date 1289928056 18000 # Node ID 1bf064c8ab88621dd58890f6cd56ad4900d10d6b # Parent 2e2ee0289d67d244954aa05bfe315dbb5ff413eb Fixed functional tests and samples grid alignment bug --- a/test/functional/test_sample_tracking.py +++ b/test/functional/test_sample_tracking.py @@ -341,7 +341,7 @@ class TestFormsAndRequests( TwillTestCas request_id=self.security.encode_id( request1.id ), strings_displayed=[ 'History of sequencing request "%s"' % request1.name, request1.states.NEW, - 'Request created' ], + 'Sequencing request created' ], strings_not_displayed=[ request1.states.SUBMITTED, request1.states.COMPLETE, request1.states.REJECTED ] ) @@ -412,7 +412,7 @@ class TestFormsAndRequests( TwillTestCas self.add_samples( cntrller='requests', request_id=self.security.encode_id( request1.id ), sample_value_tuples=sample_value_tuples, - strings_displayed=[ 'Add Samples to Request "%s"' % request1.name, + strings_displayed=[ 'Add Samples to Sequencing Request "%s"' % request1.name, '<input type="text" name="sample_0_name" value="Sample_1" size="10"/>' ], # sample name input field strings_displayed_after_submit=strings_displayed_after_submit ) # check the new sample field values on the request page @@ -446,7 +446,7 @@ class TestFormsAndRequests( TwillTestCas self.edit_samples( cntrller='requests', request_id=self.security.encode_id( request1.id ), sample_value_tuples=new_sample_value_tuples, - strings_displayed=[ 'Edit Current Samples of Request "%s"' % request1.name, + strings_displayed=[ 'Edit Current Samples of Sequencing Request "%s"' % request1.name, '<input type="text" name="sample_0_name" value="Sample1" size="10"/>' ], # sample name input field strings_displayed_after_submit=strings_displayed_after_submit ) # check the changed sample field values on the request page @@ -465,14 +465,14 @@ class TestFormsAndRequests( TwillTestCas self.submit_request( cntrller='requests', request_id=self.security.encode_id( request1.id ), request_name=request1.name, - strings_displayed_after_submit=[ 'The request has been submitted.' ] ) + strings_displayed_after_submit=[ 'The sequencing request has been submitted.' ] ) refresh( request1 ) # Make sure the request is showing in the 'submitted' filter self.check_request_grid( cntrller='requests', state=request1.states.SUBMITTED, strings_displayed=[ request1.name ] ) # Make sure the request's state is now set to 'submitted' - assert request1.state is not request1.states.SUBMITTED, "The state of the request '%s' should be set to '%s'" \ + assert request1.state is not request1.states.SUBMITTED, "The state of the sequencing request '%s' should be set to '%s'" \ % ( request1.name, request1.states.SUBMITTED ) # the sample state should appear once for each sample strings_displayed_count = [ ( request1.type.states[0].name, len( request1.samples ) ) ] @@ -485,8 +485,8 @@ class TestFormsAndRequests( TwillTestCas strings_displayed_count=strings_displayed_count, strings_not_displayed=strings_not_displayed ) strings_displayed=[ 'History of sequencing request "%s"' % request1.name, - 'Request submitted by %s' % regular_user1.email, - 'Request created' ] + 'Sequencing request submitted by %s' % regular_user1.email, + 'Sequencing request created' ] strings_displayed_count = [ ( request1.states.SUBMITTED, 1 ) ] self.view_request_history( cntrller='requests', request_id=self.security.encode_id( request1.id ), @@ -519,7 +519,7 @@ class TestFormsAndRequests( TwillTestCas self.add_bar_codes( cntrller='requests_admin', request_id=self.security.encode_id( request1.id ), bar_codes=bar_codes, - strings_displayed=[ 'Edit Current Samples of Request "%s"' % request1.name ], + strings_displayed=[ 'Edit Current Samples of Sequencing Request "%s"' % request1.name ], strings_displayed_after_submit=strings_displayed_after_submit ) # the second sample state should appear once for each sample strings_displayed_count = [ ( request1.type.states[1].name, len( request1.samples ) ), @@ -538,7 +538,7 @@ class TestFormsAndRequests( TwillTestCas # check history of each sample for sample in request1.samples: strings_displayed = [ 'Events for Sample "%s"' % sample.name, - 'Request submitted and sample state set to %s' % request1.type.states[0].name, + 'Sequencing request submitted and sample state set to %s' % request1.type.states[0].name, request1.type.states[0].name, request1.type.states[1].name ] self.view_sample_history( cntrller='requests_admin', @@ -558,9 +558,9 @@ class TestFormsAndRequests( TwillTestCas if index > 1: # status message if index == len( request_type1.states ) - 1: - status_msg = 'All samples of this request are in the final sample state (%s).' % state.name + status_msg = 'All samples of this sequencing request are in the final sample state (%s).' % state.name else: - status_msg = 'All samples of this request are in the (%s) sample state. ' % state.name + status_msg = 'All samples of this sequencing request are in the (%s) sample state. ' % state.name # check email notification message email_msg = '' if state.id in [ email_state.id for email_state in email_notification_sample_states ]: @@ -568,7 +568,7 @@ class TestFormsAndRequests( TwillTestCas self.change_sample_state( request_id=self.security.encode_id( request1.id ), sample_ids=[ sample.id for sample in request1.samples ], new_sample_state_id=self.security.encode_id( state.id ), - strings_displayed=[ 'Edit Current Samples of Request "%s"' % request1.name ], + strings_displayed=[ 'Edit Current Samples of Sequencing Request "%s"' % request1.name ], strings_displayed_after_submit = [ status_msg, email_msg ] ) # check request history page if index == len( request_type1.states ) - 1: @@ -584,7 +584,7 @@ class TestFormsAndRequests( TwillTestCas self.check_request_grid( cntrller='requests_admin', state='Complete', strings_displayed=[ request1.name ] ) - assert request1.state is not request1.states.COMPLETE, "The state of the request '%s' should be set to '%s'" \ + assert request1.state is not request1.states.COMPLETE, "The state of the sequencing request '%s' should be set to '%s'" \ % ( request1.name, request1.states.COMPLETE ) # def test_045_admin_create_request_on_behalf_of_regular_user( self ): --- a/templates/requests/common/common.mako +++ b/templates/requests/common/common.mako @@ -113,27 +113,23 @@ </script></%def> -<%def name="render_editable_sample_row( cntrller, sample, sample_widget_index, sample_widget, encoded_selected_sample_ids )"> +<%def name="render_editable_sample_row( cntrller, request, sample, sample_widget_index, sample_widget, encoded_selected_sample_ids )"><% + trans.sa_session.refresh( request ) is_admin = cntrller == 'requests_admin' and trans.user_is_admin() + is_rejected = request.is_rejected + is_complete = request.is_complete + is_submitted = request.is_submitted + is_unsubmitted = request.is_unsubmitted if sample: - trans.sa_session.refresh( sample.request ) - is_complete = sample.request.is_complete - is_rejected = request.is_rejected - is_submitted = sample.request.is_submitted - is_unsubmitted = sample.request.is_unsubmitted can_delete_samples = editing_samples and request.samples and ( ( is_admin and not is_complete ) or is_unsubmitted ) display_checkboxes = editing_samples and ( is_complete or is_rejected or is_submitted ) - display_bar_code = request.samples and ( is_complete or is_rejected or is_submitted ) display_datasets = request.samples and ( is_complete or is_submitted ) else: - is_complete = False - is_submitted = False - is_unsubmitted = False can_delete_samples = False display_checkboxes = False - display_bar_code = False display_datasets = False + display_bar_code = request.samples and ( is_complete or is_rejected or is_submitted ) %><% if display_checkboxes and trans.security.encode_id( sample.id ) in encoded_selected_sample_ids: @@ -152,15 +148,13 @@ </td> %if display_bar_code: <td valign="top"> - %if is_admin: + %if is_admin and is_submitted: <input type="text" name="sample_${sample_widget_index}_bar_code" value="${sample_widget['bar_code']}" size="10"/> %else: ${sample_widget['bar_code']} <input type="hidden" name="sample_${sample_widget_index}_bar_code" value="${sample_widget['bar_code']}"/> %endif </td> - %else: - <td></td> %endif %if sample: %if is_unsubmitted: @@ -305,7 +299,7 @@ sample = None %> %if editing_samples: - <tr>${render_editable_sample_row( cntrller, sample, sample_widget_index, sample_widget, encoded_selected_sample_ids )}</tr> + <tr>${render_editable_sample_row( cntrller, request, sample, sample_widget_index, sample_widget, encoded_selected_sample_ids )}</tr> %elif sample: <tr><td> @@ -401,7 +395,7 @@ </tr> %else: ## The Add sample button was clicked for this sample_widget - <tr>${render_editable_sample_row( cntrller, None, sample_widget_index, sample_widget, encoded_selected_sample_ids )}</tr> + <tr>${render_editable_sample_row( cntrller, request, None, sample_widget_index, sample_widget, encoded_selected_sample_ids )}</tr> %endif %endfor </tbody>