本文整理汇总了Python中tool_shed.base.test_db_util.get_user函数的典型用法代码示例。如果您正苦于以下问题:Python get_user函数的具体用法?Python get_user怎么用?Python get_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_user函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_0000_initiate_users
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)
示例2: test_0070_review_tools
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))
示例3: test_0070_review_tools
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 ) )
示例4: test_0000_initiate_users
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 )
示例5: test_0025_load_view_page_for_previous_revision
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='user1',
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 )
示例6: test_0020_load_repository_view_page
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='user1',
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 )
示例7: test_0100_verify_reserved_username_handling
def test_0100_verify_reserved_username_handling( self ):
'''Check that reserved usernames are handled correctly.'''
self.logout()
self.login( email='[email protected]', username='repos' )
test_user_1 = test_db_util.get_user( '[email protected]' )
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.' ] )
示例8: test_0035_load_sharable_url_with_invalid_repository_name
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='user1',
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 )
示例9: test_0135_verify_review_for_new_version
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)
示例10: test_0110_review_new_changeset_functional_tests
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),
)
示例11: test_0090_upload_readme_file
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" )
示例12: test_0105_upload_test_data
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." )
示例13: test_0080_review_workflows
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)
示例14: test_0030_review_initial_revision_functional_tests
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)
示例15: test_0030_load_sharable_url_with_invalid_changeset_revision
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='user1',
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 )