本文整理汇总了Python中tests.profile_utils.GSoCProfileHelper.createProfile方法的典型用法代码示例。如果您正苦于以下问题:Python GSoCProfileHelper.createProfile方法的具体用法?Python GSoCProfileHelper.createProfile怎么用?Python GSoCProfileHelper.createProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.profile_utils.GSoCProfileHelper
的用法示例。
在下文中一共展示了GSoCProfileHelper.createProfile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testInviteOrgAdmin
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createProfile [as 别名]
def testInviteOrgAdmin(self):
# test GET
self.data.createOrgAdmin(self.org)
url = '/gsoc/invite/org_admin/' + self.org.key().name()
response = self.client.get(url)
self.assertInviteTemplatesUsed(response)
# create other user to send invite to
other_data = GSoCProfileHelper(self.gsoc, self.dev_test)
other_user = other_data.createOtherUser('[email protected]')
other_data.createProfile()
# test POST
override = {'link_id': other_user.link_id, 'status': 'pending',
'role': 'org_admin', 'user': other_user, 'group': self.org,
'type': 'Invitation'}
response, properties = self.modelPost(url, Request, override)
invitation = Request.all().get()
properties.pop('link_id')
self.assertPropertiesEqual(properties, invitation)
invitation.delete()
override['link_id'] = '[email protected]'
response, properties = self.modelPost(url, Request, override)
invitation = Request.all().get()
properties.pop('link_id')
self.assertPropertiesEqual(properties, invitation)
示例2: createRequest
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createProfile [as 别名]
def createRequest(self):
"""Creates and returns an accepted invitation for the current user.
"""
# create other user to send invite to
other_data = GSoCProfileHelper(self.gsoc, self.dev_test)
other_data.createOtherUser('[email protected]')
other_data.createProfile()
request = other_data.createMentorRequest(self.org)
return (other_data, request)
示例3: testAUserNotLoggedInIsRedirectedToLoginPage
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createProfile [as 别名]
def testAUserNotLoggedInIsRedirectedToLoginPage(self):
"""Tests that a user who is not logged in and trying to access its profile
is redirected to a login page.
"""
profile_helper = GSoCProfileHelper(self.gsoc, self.dev_test)
profile_helper.createOtherUser('[email protected]')
profile_helper.createProfile()
import os
current_logged_in_account = os.environ.get('USER_EMAIL', None)
try:
os.environ['USER_EMAIL'] = ''
url = '/gsoc/profile/admin/' + profile_helper.profile.key().name()
response = self.get(url)
self.assertResponseRedirect(response)
expected_redirect_url = 'https://www.google.com/accounts/Login?'+\
'continue=http%3A//Foo%3A8080'+url
actual_redirect_url = response.get('location', None)
self.assertEqual(expected_redirect_url, actual_redirect_url)
finally:
if current_logged_in_account is None:
del os.environ['USER_EMAIL']
else:
os.environ['USER_EMAIL'] = current_logged_in_account
示例4: testInviteOrgAdmin
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createProfile [as 别名]
def testInviteOrgAdmin(self):
# test GET
self.data.createOrgAdmin(self.org)
url = '/gsoc/invite/org_admin/' + self.org.key().name()
response = self.get(url)
self.assertInviteTemplatesUsed(response)
# create other user to send invite to
other_data = GSoCProfileHelper(self.gsoc, self.dev_test)
other_data.createOtherUser('[email protected]')
other_data.createProfile()
other_data.notificationSettings(new_invites=True)
other_user = other_data.user
# test POST
override = {
'link_id': other_user.link_id, 'status': 'pending',
'role': 'org_admin', 'user': other_user, 'org': self.org,
'type': 'Invitation',
'parent': other_user,
}
response, properties = self.modelPost(url, GSoCRequest, override)
self.assertEmailSent(to=other_data.profile.email, n=1)
invitation = GSoCRequest.all().get()
properties.pop('link_id')
self.assertPropertiesEqual(properties, invitation)
other_data2 = GSoCProfileHelper(self.gsoc, self.dev_test)
other_data2.createOtherUser('[email protected]')
other_data2.createProfile()
other_data2.notificationSettings()
invitation.delete()
override['link_id'] = '[email protected], [email protected]'
other_data.notificationSettings()
response, properties = self.modelPost(url, GSoCRequest, override)
self.assertEmailSent(to=other_data.profile.email, n=1)
invitations = GSoCRequest.all().fetch(2)
self.assertEqual(2, len(invitations))
invitation = invitations[0]
properties.pop('link_id')
self.assertPropertiesEqual(properties, invitation)
properties['user'] = other_data2.user
properties['parent'] = other_data2.user
self.assertPropertiesEqual(properties, invitations[1])
# test withdraw/resubmit invite
url = '/gsoc/invitation/%s/%s/%s' % (
self.gsoc.key().name(),
invitation.parent_key().name(),
invitation.key().id())
other_data.notificationSettings(invite_handled=True)
postdata = {'action': 'Withdraw'}
response = self.post(url, postdata)
self.assertResponseRedirect(response)
invite = GSoCRequest.all().get()
self.assertEqual('withdrawn', invite.status)
self.assertEmailSent(to=other_data.profile.email, n=2)
# test that you can resubmit
postdata = {'action': 'Resubmit'}
response = self.post(url, postdata)
self.assertResponseRedirect(response)
invite = GSoCRequest.all().get()
self.assertEqual('pending', invite.status)
self.assertEmailSent(to=other_data.profile.email, n=3)