def test_0070_review_tools(self):
     """Review the tools component for the current tip revision."""
     """
     We are at step 15.
     Log in as test_user_2 and update the review with the tools component given 
     a favorable review, with 5 stars, and approved status.
     # Review this revision: 
     #    Data types (N/A)
     #    Functional tests (One star, comment 'functional tests missing')    
     #    README (N/A)
     #    Repository dependencies (N/A)
     #    Tool dependencies (N/A)
     #    Tools (5 stars, good review)
     """
     self.logout()
     self.login(email=common.test_user_2_email, username=common.test_user_2_name)
     repository = test_db_util.get_repository_by_name_and_owner(repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     # The create_repository_review method takes a dict( component label=review contents ).
     # If review_contents is empty, it marks that component as not applicable. The review
     # contents dict should have the structure:
     # {
     #   rating: 1-5,
     #   comment: <text>
     #   approved: yes/no
     #   private: yes/no
     # }
     review_contents_dict = {
         "Tools": dict(rating=5, comment="Excellent tool, easy to use.", approved="yes", private="no")
     }
     self.review_repository(repository, review_contents_dict, test_db_util.get_user(common.test_user_2_email))
 def test_0000_initiate_users(self):
     """Create necessary user accounts and login as an admin user."""
     """
     We are at step 1.
     Create all the user accounts that are needed for this test script to run independently of other test.
     Previously created accounts will not be re-created.
     """
     self.logout()
     self.login(email=common.test_user_1_email, username=common.test_user_1_name)
     test_user_1 = test_db_util.get_user(common.test_user_1_email)
     assert test_user_1 is not None, (
         "Problem retrieving user with email %s from the database" % common.test_user_1_email
     )
     test_user_1_private_role = test_db_util.get_private_role(test_user_1)
     self.logout()
     self.login(email=common.test_user_2_email, username=common.test_user_2_name)
     test_user_2 = test_db_util.get_user(common.test_user_2_email)
     assert test_user_2 is not None, (
         "Problem retrieving user with email %s from the database" % common.test_user_2_email
     )
     test_user_2_private_role = test_db_util.get_private_role(test_user_2)
     self.logout()
     self.login(email=common.admin_email, username=common.admin_username)
     admin_user = test_db_util.get_user(common.admin_email)
     assert admin_user is not None, "Problem retrieving user with email %s from the database" % common.admin_email
     admin_user_private_role = test_db_util.get_private_role(admin_user)
Example #3
0
 def test_0070_review_tools( self ):
     '''Review the tools component for the current tip revision.'''
     """
     We are at step 15.
     Log in as test_user_2 and update the review with the tools component given 
     a favorable review, with 5 stars, and approved status.
     # Review this revision: 
     #    Data types (N/A)
     #    Functional tests (One star, comment 'functional tests missing')    
     #    README (N/A)
     #    Repository dependencies (N/A)
     #    Tool dependencies (N/A)
     #    Tools (5 stars, good review)
     """
     self.logout()
     self.login( email=common.test_user_2_email, username=common.test_user_2_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     # The create_repository_review method takes a dict( component label=review contents ). 
     # If review_contents is empty, it marks that component as not applicable. The review 
     # contents dict should have the structure:
     # { 
     #   rating: 1-5,
     #   comment: <text>
     #   approved: yes/no
     #   private: yes/no
     # }
     review_contents_dict = { 'Tools': dict( rating=5, comment='Excellent tool, easy to use.', approved='yes', private='no' ) }
     self.review_repository( repository, review_contents_dict, test_db_util.get_user( common.test_user_2_email ) )
Example #4
0
 def test_0000_initiate_users(self):
     """Create necessary user accounts and login as an admin user."""
     """
     Create all the user accounts that are needed for this test script to run independently of other test.
     Previously created accounts will not be re-created.
     """
     self.logout()
     self.login(email=common.test_user_1_email,
                username=common.test_user_1_name)
     test_user_1 = test_db_util.get_user(common.test_user_1_email)
     assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % common.test_user_1_email
     test_user_1_private_role = test_db_util.get_private_role(test_user_1)
     self.logout()
     self.login(email=common.test_user_2_email,
                username=common.test_user_2_name)
     test_user_2 = test_db_util.get_user(common.test_user_2_email)
     assert test_user_2 is not None, 'Problem retrieving user with email %s from the database' % common.test_user_2_email
     test_user_2_private_role = test_db_util.get_private_role(test_user_2)
     self.logout()
     self.login(email=common.test_user_3_email,
                username=common.test_user_3_name)
     test_user_3 = test_db_util.get_user(common.test_user_3_email)
     assert test_user_3 is not None, 'Problem retrieving user with email %s from the database' % common.test_user_3_email
     test_user_3_private_role = test_db_util.get_private_role(test_user_3)
     self.logout()
     self.login(email=common.admin_email, username=common.admin_username)
     admin_user = test_db_util.get_user(common.admin_email)
     assert admin_user is not None, 'Problem retrieving user with email %s from the database' % common.admin_email
     admin_user_private_role = test_db_util.get_private_role(admin_user)
 def test_0070_review_tools( self ):
     '''Review the tools component for the current tip revision.'''
     self.logout()
     self.login( email=common.test_user_2_email, username=common.test_user_2_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     review_contents_dict = { 'Tools': dict( rating=5, comment='Excellent tool, easy to use.', approved='yes', private='no' ) }
     self.review_repository( repository, review_contents_dict, test_db_util.get_user( common.test_user_2_email ) )
 def test_0000_initiate_users( self ):
     """Create necessary user accounts and login as an admin user."""
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     test_user_1 = test_db_util.get_user( common.test_user_1_email )
     assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % common.test_user_1_email
     test_user_1_private_role = test_db_util.get_private_role( test_user_1 )
     self.logout()
     self.login( email=common.admin_email, username=common.admin_username )
     admin_user = test_db_util.get_user( common.admin_email )
     assert admin_user is not None, 'Problem retrieving user with email %s from the database' % common.admin_email
     admin_user_private_role = test_db_util.get_private_role( admin_user )
Example #7
0
 def test_0000_initiate_users( self ):
     """Create necessary user accounts."""
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     test_user_1 = test_db_util.get_user( common.test_user_1_email )
     assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % test_user_1_email
     test_user_1_private_role = test_db_util.get_private_role( test_user_1 )
     self.logout()
     self.login( email=common.admin_email, username=common.admin_username )
     admin_user = test_db_util.get_user( common.admin_email )
     assert admin_user is not None, 'Problem retrieving user with email %s from the database' % admin_email
     admin_user_private_role = test_db_util.get_private_role( admin_user )
Example #8
0
 def test_0000_initiate_users(self):
     """Create necessary user accounts and login as an admin user."""
     self.logout()
     self.login(email=common.admin_email, username=common.admin_username)
     admin_user = test_db_util.get_user(common.admin_email)
     assert admin_user is not None, 'Problem retrieving user with email %s from the database' % common.admin_email
     admin_user_private_role = test_db_util.get_private_role(admin_user)
     self.galaxy_logout()
     self.galaxy_login(email=common.admin_email,
                       username=common.admin_username)
     admin_user = test_db_util.get_user(common.admin_email)
     assert admin_user is not None, 'Problem retrieving user with email %s from the database' % common.admin_email
     admin_user_private_role = test_db_util.get_private_role(admin_user)
 def test_0030_review_initial_revision_functional_tests(self):
     """Review the functional tests component for the current tip revision."""
     """
     We are at step 7.
     Log in as test_user_2 and review the functional tests component for this repository. Since the repository 
     has not been altered, this will update the existing review to add a component.
     # Review this revision: 
     #    Data types (N/A)
     #    Functional tests (One star, comment 'functional tests missing')    
     """
     self.logout()
     self.login(email=common.test_user_2_email, username=common.test_user_2_name)
     repository = test_db_util.get_repository_by_name_and_owner(repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     # The create_repository_review method takes a dict( component label=review contents ).
     # If review_contents is empty, it marks that component as not applicable. The review
     # contents dict should have the structure:
     # {
     #   rating: 1-5,
     #   comment: <text>
     #   approved: yes/no
     #   private: yes/no
     # }
     review_contents_dict = {
         "Functional tests": dict(rating=1, comment="Functional tests missing", approved="no", private="yes")
     }
     self.review_repository(repository, review_contents_dict, user)
 def test_0125_review_new_changeset_functional_tests(self):
     '''Update the filtering repository's review to apply to the new changeset with filtering 2.2.0.'''
     self.logout()
     self.login(email=common.test_user_2_email,
                username=common.test_user_2_name)
     repository = test_db_util.get_repository_by_name_and_owner(
         repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     # Get the changeset immediately prior to the tip, and pass it to the create review method.
     changelog = self.get_repository_changelog(repository)
     changeset_revision, ctx_revision = changelog[-2]
     previous_review = test_db_util.get_repository_review_by_user_id_changeset_revision(
         user.id, repository.id, str(changeset_revision))
     # Something needs to change so that the review will save.
     review_contents_dict = {
         'Tools':
         dict(rating=5,
              comment=
              'Version 2.2.0 does the impossible and improves this tool.',
              approved='yes',
              private='yes')
     }
     self.create_repository_review(
         repository,
         review_contents_dict,
         changeset_revision=self.get_repository_tip(repository),
         copy_from=(str(changeset_revision), previous_review.id))
 def test_0110_review_new_changeset_functional_tests(self):
     '''Update the filtering repository's readme component review to reflect the presence of the readme file.'''
     self.logout()
     self.login(email=common.test_user_2_email,
                username=common.test_user_2_name)
     repository = test_db_util.get_repository_by_name_and_owner(
         repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     # Get the changeset immediately prior to the tip, and pass it to the create review method.
     changelog = self.get_repository_changelog(repository)
     changeset_revision, ctx_revision = changelog[-2]
     previous_review = test_db_util.get_repository_review_by_user_id_changeset_revision(
         user.id, repository.id, str(changeset_revision))
     review_contents_dict = {
         'Functional tests':
         dict(rating=5,
              comment='A good set of functional tests.',
              approved='yes',
              private='no')
     }
     self.create_repository_review(
         repository,
         review_contents_dict,
         changeset_revision=self.get_repository_tip(repository),
         copy_from=(str(changeset_revision), previous_review.id))
 def test_0080_review_workflows(self):
     """Review the workflows component for the current tip revision."""
     """
     We are at step 17.
     Log in as test_user_2 and update the review with the workflows component marked as 'Not applicable'.
     # Review this revision: 
     #    Data types (N/A)
     #    Functional tests (One star, comment 'functional tests missing')    
     #    README (N/A)
     #    Repository dependencies (N/A)
     #    Tool dependencies (N/A)
     #    Tools (5 stars, good review)
     #    Workflows (N/A)
     """
     self.logout()
     self.login(email=common.test_user_2_email, username=common.test_user_2_name)
     repository = test_db_util.get_repository_by_name_and_owner(repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     # The create_repository_review method takes a dict( component label=review contents ).
     # If review_contents is empty, it marks that component as not applicable. The review
     # contents dict should have the structure:
     # {
     #   rating: 1-5,
     #   comment: <text>
     #   approved: yes/no
     #   private: yes/no
     # }
     review_contents_dict = {"Workflows": dict()}
     self.review_repository(repository, review_contents_dict, user)
Example #13
0
 def test_0030_load_sharable_url_with_invalid_changeset_revision( self ):
     '''Load a citable url with an invalid changeset revision specified.'''
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     test_user_1 = test_db_util.get_user( common.test_user_1_email )
     encoded_user_id = self.security.encode_id( test_user_1.id )
     encoded_repository_id = self.security.encode_id( repository.id )
     invalid_changeset_hash = 'invalid'
     tip_revision = self.get_repository_tip( repository )
     # Since twill does not load the contents of an iframe, we need to check that the iframe has been generated correctly,
     # then directly load the url that the iframe should be loading and check for the expected strings.
     # The iframe should point to /repository/view_repository?id=<encoded repository ID>&status=error
     strings_displayed = [ '/repository', 'view_repository', 'id=' + encoded_repository_id ]
     strings_displayed.extend( [ 'The+change+log', 'does+not+include+revision', invalid_changeset_hash, 'status=error' ] )
     strings_displayed_in_iframe = [ 'user1', 'filtering_0420', 'Galaxy filtering tool for test 0420' ]
     strings_displayed_in_iframe.append( 'Sharable link to this repository revision:' )
     strings_displayed_in_iframe.append( '%s/view/user1/filtering_0420/%s' % ( self.url, invalid_changeset_hash ) )
     strings_not_displayed_in_iframe = []
     self.load_citable_url( username='******', 
                            repository_name='filtering_0420', 
                            changeset_revision=invalid_changeset_hash, 
                            encoded_user_id=encoded_user_id, 
                            encoded_repository_id=encoded_repository_id,
                            strings_displayed=strings_displayed, 
                            strings_displayed_in_iframe=strings_displayed_in_iframe, 
                            strings_not_displayed_in_iframe=strings_not_displayed_in_iframe )
 def test_0090_upload_readme_file( self ):
     '''Upload a readme file to the filtering repository.'''
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     self.upload_file( repository, 'readme.txt', commit_message="Uploaded readme.txt" )
Example #15
0
 def test_0020_load_repository_view_page( self ):
     '''Load the /view/<user>/<repository> page and check for the appropriate strings.'''
     '''
     We are at step 4.
     Visit the following url and check for strings: <tool shed base url>/view/user1/filtering_0420
         Resulting page should contain change set revision 1
     '''
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     test_user_1 = test_db_util.get_user( common.test_user_1_email )
     encoded_user_id = self.security.encode_id( test_user_1.id )
     encoded_repository_id = self.security.encode_id( repository.id )
     # Since twill does not load the contents of an iframe, we need to check that the iframe has been generated correctly,
     # then directly load the url that the iframe should be loading and check for the expected strings.
     # The iframe should point to /repository/bview_repository?id=<encoded repository ID>
     strings_displayed = [ '/repository', 'view_repository', 'id=', encoded_repository_id ]
     strings_displayed_in_iframe = [ 'user1', 'filtering_0420', 'Galaxy filtering tool for test 0420' ]
     strings_displayed_in_iframe.append( self.get_repository_tip( repository ) )
     strings_displayed_in_iframe.append( 'Sharable link to this repository:' )
     strings_displayed_in_iframe.append( '%s/view/user1/filtering_0420' % self.url )
     self.load_citable_url( username='******', 
                            repository_name='filtering_0420', 
                            changeset_revision=None, 
                            encoded_user_id=encoded_user_id, 
                            encoded_repository_id=encoded_repository_id,
                            strings_displayed=strings_displayed, 
                            strings_displayed_in_iframe=strings_displayed_in_iframe )
Example #16
0
 def test_0025_load_view_page_for_previous_revision( self ):
     '''Load a citable url for a past changeset revision and verify that strings display.'''
     '''
     We are at step 5.
     Visit the following url and check for appropriate strings: <tool shed base url>/view/user1/filtering_0420/<revision 0>
         Resulting page should not contain change set revision 1, but should contain change set revision 0.
     '''
     global first_changeset_hash
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     test_user_1 = test_db_util.get_user( common.test_user_1_email )
     encoded_user_id = self.security.encode_id( test_user_1.id )
     encoded_repository_id = self.security.encode_id( repository.id )
     # Since twill does not load the contents of an iframe, we need to check that the iframe has been generated correctly,
     # then directly load the url that the iframe should be loading and check for the expected strings.
     # The iframe should point to /repository/view_repository?id=<encoded repository ID>
     strings_displayed = [ '/repository', 'view_repository', 'id=' + encoded_repository_id ]
     strings_displayed_in_iframe = [ 'user1', 'filtering_0420', 'Galaxy filtering tool for test 0420', first_changeset_hash ]
     strings_displayed_in_iframe.append( 'Sharable link to this repository revision:' )
     strings_displayed_in_iframe.append( '%s/view/user1/filtering_0420/%s' % ( self.url, first_changeset_hash ) )
     strings_not_displayed_in_iframe = []
     self.load_citable_url( username='******', 
                            repository_name='filtering_0420', 
                            changeset_revision=first_changeset_hash, 
                            encoded_user_id=encoded_user_id, 
                            encoded_repository_id=encoded_repository_id,
                            strings_displayed=strings_displayed, 
                            strings_displayed_in_iframe=strings_displayed_in_iframe, 
                            strings_not_displayed_in_iframe=strings_not_displayed_in_iframe )
Example #17
0
 def test_0030_review_initial_revision_functional_tests( self ):
     '''Review the functional tests component for the current tip revision.'''
     """
     We are at step 7.
     Log in as test_user_2 and review the functional tests component for this repository. Since the repository 
     has not been altered, this will update the existing review to add a component.
     # Review this revision: 
     #    Data types (N/A)
     #    Functional tests (One star, comment 'functional tests missing')    
     """
     self.logout()
     self.login( email=common.test_user_2_email, username=common.test_user_2_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     # The create_repository_review method takes a dict( component label=review contents ). 
     # If review_contents is empty, it marks that component as not applicable. The review 
     # contents dict should have the structure:
     # { 
     #   rating: 1-5,
     #   comment: <text>
     #   approved: yes/no
     #   private: yes/no
     # }
     review_contents_dict = { 'Functional tests': dict( rating=1, comment='Functional tests missing', approved='no', private='yes' ) }
     self.review_repository( repository, review_contents_dict, user )
 def test_0105_upload_test_data( self ):
     '''Upload the missing test data to the filtering repository.'''
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     self.upload_file( repository, 'filtering/filtering_test_data.tar', commit_message="Uploaded test data." )
Example #19
0
 def test_0080_review_workflows( self ):
     '''Review the workflows component for the current tip revision.'''
     """
     We are at step 17.
     Log in as test_user_2 and update the review with the workflows component marked as 'Not applicable'.
     # Review this revision: 
     #    Data types (N/A)
     #    Functional tests (One star, comment 'functional tests missing')    
     #    README (N/A)
     #    Repository dependencies (N/A)
     #    Tool dependencies (N/A)
     #    Tools (5 stars, good review)
     #    Workflows (N/A)
     """
     self.logout()
     self.login( email=common.test_user_2_email, username=common.test_user_2_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     # The create_repository_review method takes a dict( component label=review contents ). 
     # If review_contents is empty, it marks that component as not applicable. The review 
     # contents dict should have the structure:
     # { 
     #   rating: 1-5,
     #   comment: <text>
     #   approved: yes/no
     #   private: yes/no
     # }
     review_contents_dict = { 'Workflows': dict() }
     self.review_repository( repository, review_contents_dict, user )
 def test_0100_verify_reserved_username_handling( self ):
     '''Check that reserved usernames are handled correctly.'''
     self.logout()
     self.login( email='*****@*****.**', username='******' )
     test_user_1 = test_db_util.get_user( '*****@*****.**' )
     assert test_user_1 is None, 'Creating user with public name "repos" succeeded.'
     self.check_for_strings( strings_displayed=[ 'The term <b>repos</b> is a reserved word in the tool shed, so it cannot be used as a public user name.' ] )
Example #21
0
 def test_0025_verify_repository_review(self):
     '''Verify that the review was completed and displays properly.'''
     '''
     We are at step 3 - Have test_user_1 browse the review.
     Verify that all the review components were submitted, and that the repository owner can see the review.
     '''
     self.logout()
     self.login(email=common.test_user_1_email,
                username=common.test_user_1_name)
     repository = test_db_util.get_repository_by_name_and_owner(
         repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     strings_displayed = [
         'Data types', 'Functional tests', 'yes',
         'A good set of functional tests.', 'README', 'yes', 'Workflows',
         'Tools'
     ]
     strings_displayed.extend([
         'Clear and concise readme file, a true pleasure to read.',
         'Tool dependencies', 'not_applicable'
     ])
     strings_displayed.extend(
         ['Repository dependencies', 'Excellent tool, easy to use.'])
     strings_displayed = ['Browse reviews of this repository']
     self.display_manage_repository_page(
         repository, strings_displayed=strings_displayed)
     self.verify_repository_reviews(repository,
                                    reviewer=user,
                                    strings_displayed=strings_displayed)
 def test_0135_verify_review_for_new_version(self):
     """Verify that the reviews display correctly for this changeset revision."""
     """
     We are at step 27.
     Log in as test_user_1 and check that the tools component review is for filtering 2.2.0, but that the other component
     reviews had their contents copied from the last reviewed changeset.
     """
     self.logout()
     self.login(email=common.test_user_1_email, username=common.test_user_1_name)
     repository = test_db_util.get_repository_by_name_and_owner(repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     strings_displayed = [
         "Data types",
         "Functional tests",
         "yes",
         "A good set of functional tests.",
         "README",
         "yes",
         "Workflows",
         "Tools",
     ]
     strings_displayed.extend(
         ["Clear and concise readme file, a true pleasure to read.", "Tool dependencies", "not_applicable"]
     )
     strings_displayed.extend(
         ["Repository dependencies", "Version 2.2.0 does the impossible and improves this tool."]
     )
     self.verify_repository_reviews(repository, reviewer=user, strings_displayed=strings_displayed)
Example #23
0
 def test_0095_review_new_changeset_readme_component( self ):
     '''Update the filtering repository's readme component review to reflect the presence of the readme file.'''
     """
     We are at step 20.
     There is now a new changeset revision in the repository's changelog, but it has no review associated with it.
     Get the previously reviewed changeset hash, and pass that and the review id to the create_repository_review 
     method, in order to copy the previous review's contents. Then update the new review to reflect the presence of
     a readme file.
     """
     self.logout()
     self.login( email=common.test_user_2_email, username=common.test_user_2_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     # Get the last changeset revision that has a review associated with it.
     last_review = self.get_last_reviewed_revision_by_user( user, repository )
     if last_review is None:
         raise AssertionError( 'Previous review expected, none found.' )
     # The create_repository_review method takes a dict( component label=review contents ). 
     # If review_contents is empty, it marks that component as not applicable. The review 
     # contents dict should have the structure:
     # { 
     #   rating: 1-5,
     #   comment: <text>
     #   approved: yes/no
     #   private: yes/no
     # }
     review_contents_dict = { 'README': dict( rating=5, comment='Clear and concise readme file, a true pleasure to read.', approved='yes', private='no' ) }
     self.create_repository_review( repository, 
                                    review_contents_dict, 
                                    changeset_revision=self.get_repository_tip( repository ), 
                                    copy_from=( str( last_review.changeset_revision ), last_review.id ) )
Example #24
0
 def test_0110_review_new_changeset_functional_tests( self ):
     '''Update the filtering repository's readme component review to reflect the presence of the readme file.'''
     """
     We are at step 23.
     Log in as test_user_2 and get the last reviewed changeset hash, and pass that and the review id to 
     the create_repository_review method, then update the copied review to approve the functional tests
     component.
     """
     self.logout()
     self.login( email=common.test_user_2_email, username=common.test_user_2_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     # Get the changeset immediately prior to the tip, and pass it to the create review method.
     last_review = self.get_last_reviewed_revision_by_user( user, repository )
     # The create_repository_review method takes a dict( component label=review contents ). 
     # If review_contents is empty, it marks that component as not applicable. The review 
     # contents dict should have the structure:
     # { 
     #   rating: 1-5,
     #   comment: <text>
     #   approved: yes/no
     #   private: yes/no
     # }
     review_contents_dict = { 'Functional tests': dict( rating=5, comment='A good set of functional tests.', approved='yes', private='no' ) }
     self.create_repository_review( repository, 
                                    review_contents_dict, 
                                    changeset_revision=self.get_repository_tip( repository ), 
                                    copy_from=( str( last_review.changeset_revision ), last_review.id ) )
 def test_0110_review_new_changeset_functional_tests(self):
     """Update the filtering repository's readme component review to reflect the presence of the readme file."""
     """
     We are at step 23.
     Log in as test_user_2 and get the last reviewed changeset hash, and pass that and the review id to 
     the create_repository_review method, then update the copied review to approve the functional tests
     component.
     """
     self.logout()
     self.login(email=common.test_user_2_email, username=common.test_user_2_name)
     repository = test_db_util.get_repository_by_name_and_owner(repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     # Get the changeset immediately prior to the tip, and pass it to the create review method.
     last_review = self.get_last_reviewed_revision_by_user(user, repository)
     # The create_repository_review method takes a dict( component label=review contents ).
     # If review_contents is empty, it marks that component as not applicable. The review
     # contents dict should have the structure:
     # {
     #   rating: 1-5,
     #   comment: <text>
     #   approved: yes/no
     #   private: yes/no
     # }
     review_contents_dict = {
         "Functional tests": dict(rating=5, comment="A good set of functional tests.", approved="yes", private="no")
     }
     self.create_repository_review(
         repository,
         review_contents_dict,
         changeset_revision=self.get_repository_tip(repository),
         copy_from=(str(last_review.changeset_revision), last_review.id),
     )
Example #26
0
 def test_0125_review_new_changeset_functional_tests( self ):
     '''Update the filtering repository's review to apply to the new changeset with filtering 2.2.0.'''
     """
     We are at step 26.
     Log in as test_user_2 and copy the last review for this repository to the new changeset. Then
     update the tools component review to refer to the new tool version.
     """
     self.logout()
     self.login( email=common.test_user_2_email, username=common.test_user_2_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     last_review = self.get_last_reviewed_revision_by_user( user, repository )
     # Something needs to change so that the review will save.
     # The create_repository_review method takes a dict( component label=review contents ). 
     # If review_contents is empty, it marks that component as not applicable. The review 
     # contents dict should have the structure:
     # { 
     #   rating: 1-5,
     #   comment: <text>
     #   approved: yes/no
     #   private: yes/no
     # }
     review_contents_dict = { 'Tools': dict( rating=5, comment='Version 2.2.0 does the impossible and improves this tool.', approved='yes', private='yes' ) }
     self.create_repository_review( repository, 
                                    review_contents_dict, 
                                    changeset_revision=self.get_repository_tip( repository ), 
                                    copy_from=( str( last_review.changeset_revision ), last_review.id ) )
Example #27
0
 def test_0035_load_sharable_url_with_invalid_repository_name( self ):
     '''Load a citable url with an invalid changeset revision specified.'''
     '''
     We are at step 7
     Visit the following url and check for appropriate strings: <tool shed base url>/view/user1/!!invalid!!
     '''
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     test_user_1 = test_db_util.get_user( common.test_user_1_email )
     encoded_user_id = self.security.encode_id( test_user_1.id )
     tip_revision = self.get_repository_tip( repository )
     # Since twill does not load the contents of an iframe, we need to check that the iframe has been generated correctly,
     # then directly load the url that the iframe should be loading and check for the expected strings.
     # The iframe should point to /repository/browse_repositories?user_id=<encoded user ID>&operation=repositories_by_user
     strings_displayed = [ '/repository', 'browse_repositories', 'user1' ]
     strings_displayed.extend( [ 'list+of+repositories+owned', 'does+not+include+one+named', '%21%21invalid%21%21', 'status=error' ] )
     strings_displayed_in_iframe = [ 'user1', 'filtering_0420' ]
     strings_displayed_in_iframe.append( 'Repositories owned by user1' )
     strings_displayed_in_iframe.append( tip_revision )
     self.load_citable_url( username='******', 
                            repository_name='!!invalid!!', 
                            changeset_revision=None, 
                            encoded_user_id=encoded_user_id, 
                            encoded_repository_id=None,
                            strings_displayed=strings_displayed, 
                            strings_displayed_in_iframe=strings_displayed_in_iframe )
 def test_0000_create_or_login_admin_user( self ):
     """Create necessary user accounts and login as an admin user."""
     self.galaxy_logout()
     self.galaxy_login( email=common.admin_email, username=common.admin_username )
     galaxy_admin_user = test_db_util.get_galaxy_user( common.admin_email )
     assert galaxy_admin_user is not None, 'Problem retrieving user with email %s from the database' % common.admin_email
     galaxy_admin_user_private_role = test_db_util.get_galaxy_private_role( galaxy_admin_user )
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     test_user_1 = test_db_util.get_user( common.test_user_1_email )
     assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % test_user_1_email
     test_user_1_private_role = test_db_util.get_private_role( test_user_1 )
     self.logout()
     self.login( email=common.admin_email, username=common.admin_username )
     admin_user = test_db_util.get_user( common.admin_email )
     assert admin_user is not None, 'Problem retrieving user with email %s from the database' % admin_email
     admin_user_private_role = test_db_util.get_private_role( admin_user )
 def test_0085_verify_workflows_review( self ):
     '''Verify that the datatypes component review displays correctly.'''
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     strings_displayed=[ 'Workflows', 'not_applicable' ]
     self.verify_repository_reviews( repository, reviewer=user, strings_displayed=strings_displayed )
 def test_0070_review_tools(self):
     '''Review the tools component for the current tip revision.'''
     self.logout()
     self.login(email=common.test_user_2_email,
                username=common.test_user_2_name)
     repository = test_db_util.get_repository_by_name_and_owner(
         repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     review_contents_dict = {
         'Tools':
         dict(rating=5,
              comment='Excellent tool, easy to use.',
              approved='yes',
              private='no')
     }
     self.review_repository(repository, review_contents_dict,
                            test_db_util.get_user(common.test_user_2_email))
 def test_0030_review_initial_revision_functional_tests( self ):
     '''Review the datatypes component for the current tip revision.'''
     self.logout()
     self.login( email=common.test_user_2_email, username=common.test_user_2_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     review_contents_dict = { 'Functional tests': dict( rating=1, comment='Functional tests missing', approved='no', private='yes' ) }
     self.review_repository( repository, review_contents_dict, user )
 def test_0100_verify_readme_review( self ):
     '''Verify that the readme component review displays correctly.'''
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     strings_displayed = [ 'README', 'yes', 'Clear and concise readme file, a true pleasure to read.' ]
     self.verify_repository_reviews( repository, reviewer=user, strings_displayed=strings_displayed )
 def test_0060_review_tool_dependencies( self ):
     '''Review the tool dependencies component for the current tip revision.'''
     self.logout()
     self.login( email=common.test_user_2_email, username=common.test_user_2_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     review_contents_dict = { 'Tool dependencies': dict() }
     self.review_repository( repository, review_contents_dict, user )
Example #34
0
 def test_0100_verify_reserved_username_handling(self):
     '''Check that reserved usernames are handled correctly.'''
     self.logout()
     self.login(email='*****@*****.**', username='******')
     test_user_1 = test_db_util.get_user('*****@*****.**')
     assert test_user_1 is None, 'Creating user with public name "repos" succeeded.'
     error_message = 'The term <b>repos</b> is a reserved word in the tool shed, so it cannot be used as a public user name.'
     self.check_for_strings(strings_displayed=[error_message])
 def test_0115_verify_functional_tests_review( self ):
     '''Verify that the functional tests component review displays correctly.'''
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     strings_displayed=[ 'Functional tests', 'yes', 'A good set of functional tests.' ]
     self.verify_repository_reviews( repository, reviewer=user, strings_displayed=strings_displayed )
 def test_0040_review_readme( self ):
     '''Review the readme component for the current tip revision.'''
     self.logout()
     self.login( email=common.test_user_2_email, username=common.test_user_2_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     review_contents_dict = { 'README': dict() }
     self.review_repository( repository, review_contents_dict, user )
Example #37
0
 def test_0000_initiate_users_and_category( self ):
     """Create necessary user accounts and login as an admin user."""
     self.logout()
     self.login( email=common.admin_email, username=common.admin_username )
     admin_user = test_db_util.get_user( common.admin_email )
     assert admin_user is not None, 'Problem retrieving user with email %s from the database' % common.admin_email
     admin_user_private_role = test_db_util.get_private_role( admin_user )
     self.create_category( name=category_name, description=category_description )
     self.logout()
     self.login( email=common.test_user_2_email, username=common.test_user_2_name )
     test_user_2 = test_db_util.get_user( common.test_user_2_email )
     assert test_user_2 is not None, 'Problem retrieving user with email %s from the database' % common.test_user_2_email
     test_user_2_private_role = test_db_util.get_private_role( test_user_2 )
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     test_user_1 = test_db_util.get_user( common.test_user_1_email )
     assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % common.test_user_1_email
     test_user_1_private_role = test_db_util.get_private_role( test_user_1 )
 def test_0075_verify_tools_review( self ):
     '''Verify that the datatypes component review displays correctly.'''
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     strings_displayed=[ 'Tools', 'yes', 'Excellent tool, easy to use.' ]
     strings_not_displayed = [ 'Workflows' ]
     self.verify_repository_reviews( repository, reviewer=user, strings_displayed=strings_displayed )
 def test_0005_grant_reviewer_role( self ):
     '''Grant the repository reviewer role to test_user_2.'''
     """
     We now have an admin user (admin_user) and three non-admin users (test_user_1, test_user_2, and test_user_3). Grant the repository 
     reviewer role to test_user_2, who will not be the owner of the reviewed repositories, and do not grant any roles to test_user_3 yet.
     """
     reviewer_role = test_db_util.get_role_by_name( 'Repository Reviewer' )
     test_user_2 = test_db_util.get_user( common.test_user_2_email )
     self.grant_role_to_user( test_user_2, reviewer_role )
 def test_0035_verify_functional_test_review( self ):
     '''Verify that the datatypes component review displays correctly.'''
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     strings_displayed=[ 'Functional tests', 'Functional tests missing', 'no' ]
     strings_not_displayed = [ 'README', 'Repository dependencies', 'Tool dependencies', 'Tools', 'Workflows' ]
     self.verify_repository_reviews( repository, reviewer=user, strings_displayed=strings_displayed )
Example #41
0
 def test_0005_grant_reviewer_role(self):
     '''Grant the repository reviewer role to test_user_2.'''
     """
     We now have an admin user (admin_user) and three non-admin users (test_user_1, test_user_2, and test_user_3). Grant the repository 
     reviewer role to test_user_2, who will not be the owner of the reviewed repositories, and do not grant any roles to test_user_3 yet.
     """
     reviewer_role = test_db_util.get_role_by_name('Repository Reviewer')
     test_user_2 = test_db_util.get_user(common.test_user_2_email)
     self.grant_role_to_user(test_user_2, reviewer_role)
 def test_0135_verify_review_for_new_version( self ):
     '''Verify that the reviews display correctly for this changeset revision.'''
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     strings_displayed = [ 'Data types', 'Functional tests', 'yes', 'A good set of functional tests.', 'README', 'yes', 'Workflows', 'Tools' ]
     strings_displayed.extend( [ 'Clear and concise readme file, a true pleasure to read.', 'Tool dependencies', 'not_applicable' ] )
     strings_displayed.extend( [ 'Repository dependencies', 'Version 2.2.0 does the impossible and improves this tool.'  ] )
     self.verify_repository_reviews( repository, reviewer=user, strings_displayed=strings_displayed )
 def test_0005_grant_reviewer_role(self):
     """Grant the repository reviewer role to test_user_2."""
     """
     We are at step 2.
     We now have an admin user (admin_user) and two non-admin users (test_user_1 and test_user_2). Grant the repository 
     reviewer role to test_user_2, who will not be the owner of the reviewed repositories.
     """
     reviewer_role = test_db_util.get_role_by_name("Repository Reviewer")
     test_user_2 = test_db_util.get_user(common.test_user_2_email)
     self.grant_role_to_user(test_user_2, reviewer_role)
Example #44
0
 def test_0005_grant_reviewer_role( self ):
     '''Grant the repository reviewer role to test_user_2.'''
     """
     We are at step 2.
     We now have an admin user (admin_user) and two non-admin users (test_user_1 and test_user_2). Grant the repository 
     reviewer role to test_user_2, who will not be the owner of the reviewed repositories.
     """
     reviewer_role = test_db_util.get_role_by_name( 'Repository Reviewer' )
     test_user_2 = test_db_util.get_user( common.test_user_2_email )
     self.grant_role_to_user( test_user_2, reviewer_role )
 def test_0080_review_workflows(self):
     '''Review the workflows component for the current tip revision.'''
     self.logout()
     self.login(email=common.test_user_2_email,
                username=common.test_user_2_name)
     repository = test_db_util.get_repository_by_name_and_owner(
         repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     review_contents_dict = {'Workflows': dict()}
     self.review_repository(repository, review_contents_dict, user)
 def test_0120_upload_new_tool_version( self ):
     '''Upload filtering 2.2.0 to the filtering repository.'''
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     self.upload_file( repository, 
                       'filtering/filtering_2.2.0.tar', 
                       commit_message="Uploaded filtering 2.2.0", 
                       remove_repo_files_not_in_tar='No' )
 def test_0105_upload_test_data(self):
     '''Upload the missing test data to the filtering repository.'''
     self.logout()
     self.login(email=common.test_user_1_email,
                username=common.test_user_1_name)
     repository = test_db_util.get_repository_by_name_and_owner(
         repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     self.upload_file(repository,
                      'filtering/filtering_test_data.tar',
                      commit_message="Uploaded test data.")
 def test_0090_upload_readme_file(self):
     '''Upload a readme file to the filtering repository.'''
     self.logout()
     self.login(email=common.test_user_1_email,
                username=common.test_user_1_name)
     repository = test_db_util.get_repository_by_name_and_owner(
         repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     self.upload_file(repository,
                      'readme.txt',
                      commit_message="Uploaded readme.txt")
 def test_0120_upload_new_tool_version(self):
     '''Upload filtering 2.2.0 to the filtering repository.'''
     self.logout()
     self.login(email=common.test_user_1_email,
                username=common.test_user_1_name)
     repository = test_db_util.get_repository_by_name_and_owner(
         repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     self.upload_file(repository,
                      'filtering/filtering_2.2.0.tar',
                      commit_message="Uploaded filtering 2.2.0",
                      remove_repo_files_not_in_tar='No')
 def test_0085_verify_workflows_review(self):
     '''Verify that the datatypes component review displays correctly.'''
     self.logout()
     self.login(email=common.test_user_1_email,
                username=common.test_user_1_name)
     repository = test_db_util.get_repository_by_name_and_owner(
         repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     strings_displayed = ['Workflows', 'not_applicable']
     self.verify_repository_reviews(repository,
                                    reviewer=user,
                                    strings_displayed=strings_displayed)
Example #51
0
 def test_0085_verify_workflows_review( self ):
     '''Verify that the workflows component review displays correctly.'''
     """
     We are at step 18.
     Log in as test_user_1 and verify that the repository component reviews now include a review 
     for the workflows component.
     """
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     strings_displayed=[ 'Workflows', 'not_applicable' ]
     self.verify_repository_reviews( repository, reviewer=user, strings_displayed=strings_displayed )
 def test_0085_verify_workflows_review(self):
     """Verify that the workflows component review displays correctly."""
     """
     We are at step 18.
     Log in as test_user_1 and verify that the repository component reviews now include a review 
     for the workflows component.
     """
     self.logout()
     self.login(email=common.test_user_1_email, username=common.test_user_1_name)
     repository = test_db_util.get_repository_by_name_and_owner(repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     strings_displayed = ["Workflows", "not_applicable"]
     self.verify_repository_reviews(repository, reviewer=user, strings_displayed=strings_displayed)
 def test_0100_verify_readme_review(self):
     """Verify that the readme component review displays correctly."""
     """
     We are at step 21.
     Log in as the repository owner (test_user_1) and check the repository component reviews to
     verify that the readme component is now reviewed and approved.
     """
     self.logout()
     self.login(email=common.test_user_1_email, username=common.test_user_1_name)
     repository = test_db_util.get_repository_by_name_and_owner(repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     strings_displayed = ["README", "yes", "Clear and concise readme file, a true pleasure to read."]
     self.verify_repository_reviews(repository, reviewer=user, strings_displayed=strings_displayed)
Example #54
0
 def test_0115_verify_functional_tests_review( self ):
     '''Verify that the functional tests component review displays correctly.'''
     """
     We are at step 24.
     Log in as the repository owner, test_user_1, and verify that the new revision's functional tests component
     review has been updated with an approved status and favorable comment.
     """
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     strings_displayed=[ 'Functional tests', 'yes', 'A good set of functional tests.' ]
     self.verify_repository_reviews( repository, reviewer=user, strings_displayed=strings_displayed )
 def test_0115_verify_functional_tests_review(self):
     """Verify that the functional tests component review displays correctly."""
     """
     We are at step 24.
     Log in as the repository owner, test_user_1, and verify that the new revision's functional tests component
     review has been updated with an approved status and favorable comment.
     """
     self.logout()
     self.login(email=common.test_user_1_email, username=common.test_user_1_name)
     repository = test_db_util.get_repository_by_name_and_owner(repository_name, common.test_user_1_name)
     user = test_db_util.get_user(common.test_user_2_email)
     strings_displayed = ["Functional tests", "yes", "A good set of functional tests."]
     self.verify_repository_reviews(repository, reviewer=user, strings_displayed=strings_displayed)
Example #56
0
 def test_0100_verify_readme_review( self ):
     '''Verify that the readme component review displays correctly.'''
     """
     We are at step 21.
     Log in as the repository owner (test_user_1) and check the repository component reviews to
     verify that the readme component is now reviewed and approved.
     """
     self.logout()
     self.login( email=common.test_user_1_email, username=common.test_user_1_name )
     repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
     user = test_db_util.get_user( common.test_user_2_email )
     strings_displayed = [ 'README', 'yes', 'Clear and concise readme file, a true pleasure to read.' ]
     self.verify_repository_reviews( repository, reviewer=user, strings_displayed=strings_displayed )