galaxy-dist commit 03b74e3675f0: sample tracking functional tests are fixed
# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User rc # Date 1287161361 14400 # Node ID 03b74e3675f0344005ad491f74d2fb0aa56cb010 # Parent d4b85e30e56d605edc2236ccba5cde41bda1510a sample tracking functional tests are fixed --- a/test/base/twilltestcase.py +++ b/test/base/twilltestcase.py @@ -1540,7 +1540,7 @@ class TwillTestCase( unittest.TestCase ) def add_bar_codes( self, request_id, request_name, bar_codes, samples, strings_displayed_after_submit=[] ): # We have to simulate the form submission here since twill barfs on the page # gvk - 9/22/10 - TODO: make sure the mako template produces valid html - url = "%s/requests_common/manage_request?cntrller=requests_admin&id=%s&edit_samples_button=Edit+samples" % ( self.url, request_id ) + url = "%s/requests_common/manage_request?cntrller=requests_admin&id=%s&managing_samples=True" % ( self.url, request_id ) for index, field_value in enumerate( bar_codes ): sample_field_name = "sample_%i_name" % index sample_field_value = samples[ index ].name.replace( ' ', '+' ) @@ -1551,20 +1551,23 @@ class TwillTestCase( unittest.TestCase ) self.visit_url( url ) for check_str in strings_displayed_after_submit: self.check_page_for_string( check_str ) - def change_sample_state( self, request_id, request_name, sample_name, sample_id, new_sample_state_id, new_state_name, comment='', + def change_sample_state( self, request_id, request_name, sample_names, sample_ids, new_sample_state_id, new_state_name, comment='', strings_displayed=[], strings_displayed_after_submit=[] ): # We have to simulate the form submission here since twill barfs on the page # gvk - 9/22/10 - TODO: make sure the mako template produces valid html url = "%s/requests_common/manage_request?cntrller=requests_admin&id=%s" % ( self.url, request_id ) - # select_sample_%i=true must be included twice to simulate a CheckboxField checked setting. - url += "&comment=%s&select_sample_%i=true&select_sample_%i=true&sample_state_id=%i" % ( comment, sample_id, sample_id, new_sample_state_id ) + url += "&comment=%s&sample_state_id=%s" % ( comment, self.security.encode_id( new_sample_state_id ) ) + # select_sample_%i=true must be included twice for each sample to simulate a CheckboxField checked setting. + for sample_id in sample_ids: + url += "&select_sample_%i=true&select_sample_%i=true" % ( sample_id, sample_id ) url += "&sample_operation=Change%20state&refresh=true" url += "&change_state_button=Save" self.visit_url( url ) self.check_page_for_string( 'Sequencing Request "%s"' % request_name ) - self.visit_url( "%s/requests_common/sample_events?cntrller=requests_admin&sample_id=%i" % ( self.url, sample_id ) ) - self.check_page_for_string( 'Events for Sample "%s"' % sample_name ) - self.check_page_for_string( new_state_name ) + for sample_id, sample_name in zip( sample_ids, sample_names ): + self.visit_url( "%s/requests_common/sample_events?cntrller=requests_admin&sample_id=%s" % ( self.url, self.security.encode_id( sample_id ) ) ) + self.check_page_for_string( 'Events for Sample "%s"' % sample_name ) + self.check_page_for_string( new_state_name ) def add_user_address( self, user_id, address_dict ): self.home() self.visit_url( "%s/user/new_address?admin_view=False&user_id=%i" % ( self.url, user_id ) ) --- a/test/functional/test_forms_and_requests.py +++ b/test/functional/test_forms_and_requests.py @@ -209,7 +209,7 @@ class TestFormsAndRequests( TwillTestCas name=name, desc=desc, field_value_tuples=field_value_tuples, - strings_displayed=[ 'Create a new request', + strings_displayed=[ 'Create a new sequencing request', test_field_name1, test_field_name2, test_field_name3 ], @@ -272,8 +272,6 @@ class TestFormsAndRequests( TwillTestCas def test_040_request_lifecycle( self ): """Testing request life-cycle as it goes through all the states""" # logged in as regular_user1 - """ - TODO: debug this test case... self.logout() self.login( email=admin_user.email ) self.check_request_grid( cntrller='requests_admin', @@ -292,19 +290,18 @@ class TestFormsAndRequests( TwillTestCas samples=request_one.samples, strings_displayed_after_submit=strings_displayed_after_submit ) # Change the states of all the samples of this request to ultimately be COMPLETE - for sample in request_one.samples: - self.change_sample_state( request_id=self.security.encode_id( request_one.id ), - request_name=request_one.name, - sample_name=sample.name, - sample_id=self.security.encode_id( sample.id ), - new_sample_state_id=request_type1.states[1].id, - new_state_name=request_type1.states[1].name ) - self.change_sample_state( request_id=self.security.encode_id( request_one.id ), - request_name=request_one.name, - sample_name=sample.name, - sample_id=self.security.encode_id( sample.id ), - new_sample_state_id=request_type1.states[2].id, - new_state_name=request_type1.states[2].name ) + self.change_sample_state( request_id=self.security.encode_id( request_one.id ), + request_name=request_one.name, + sample_names=[ sample.name for sample in request_one.samples ], + sample_ids=[ sample.id for sample in request_one.samples ], + new_sample_state_id=request_type1.states[1].id, + new_state_name=request_type1.states[1].name ) + self.change_sample_state( request_id=self.security.encode_id( request_one.id ), + request_name=request_one.name, + sample_names=[ sample.name for sample in request_one.samples ], + sample_ids=[ sample.id for sample in request_one.samples ], + new_sample_state_id=request_type1.states[2].id, + new_state_name=request_type1.states[2].name ) refresh( request_one ) self.logout() self.login( email=regular_user1.email ) @@ -314,7 +311,7 @@ class TestFormsAndRequests( TwillTestCas strings_displayed=[ request_one.name ] ) assert request_one.state is not request_one.states.COMPLETE, "The state of the request '%s' should be set to '%s'" \ % ( request_one.name, request_one.states.COMPLETE ) - """ + def test_045_admin_create_request_on_behalf_of_regular_user( self ): """Testing creating and submitting a request as an admin on behalf of a regular user""" # Logged in as regular_user1 @@ -332,7 +329,7 @@ class TestFormsAndRequests( TwillTestCas name=name, desc=desc, field_value_tuples=field_value_tuples, - strings_displayed=[ 'Create a new request', + strings_displayed=[ 'Create a new sequencing request', test_field_name1, test_field_name2, test_field_name3 ],
participants (1)
-
commits-noreply@bitbucket.org