当前位置: 首页>>代码示例>>Python>>正文


Python GSoCProfileHelper.createProfile方法代码示例

本文整理汇总了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)
开发者ID:SRabbelier,项目名称:Melange,代码行数:31,代码来源:test_invite.py

示例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)
开发者ID:praveen97uma,项目名称:GSoC-Docs,代码行数:12,代码来源:test_request.py

示例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
开发者ID:adviti,项目名称:melange,代码行数:25,代码来源:test_profile_show.py

示例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)
开发者ID:praveen97uma,项目名称:GSoC-Docs,代码行数:72,代码来源:test_invite.py


注:本文中的tests.profile_utils.GSoCProfileHelper.createProfile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。