本文整理汇总了Python中tests.profile_utils.GSoCProfileHelper.createOrgAdmin方法的典型用法代码示例。如果您正苦于以下问题:Python GSoCProfileHelper.createOrgAdmin方法的具体用法?Python GSoCProfileHelper.createOrgAdmin怎么用?Python GSoCProfileHelper.createOrgAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.profile_utils.GSoCProfileHelper
的用法示例。
在下文中一共展示了GSoCProfileHelper.createOrgAdmin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createOrgAdmin
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOrgAdmin [as 别名]
def createOrgAdmin(self, email, organization):
"""Creates an organization admin for the given organization.
"""
profile_helper = GSoCProfileHelper(self.program, dev_test=False)
profile_helper.createOtherUser(email)
admin = profile_helper.createOrgAdmin(organization)
return admin
示例2: testRequestMentor
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOrgAdmin [as 别名]
def testRequestMentor(self):
admin = GSoCProfileHelper(self.gsoc, self.dev_test)
admin.createOtherUser('[email protected]')
admin.createOrgAdmin(self.org)
admin.notificationSettings(new_requests=True)
other_admin = GSoCProfileHelper(self.gsoc, self.dev_test)
other_admin.createOtherUser('[email protected]')
other_admin.createOrgAdmin(self.org)
other_admin.notificationSettings()
# test GET
self.data.createProfile()
url = '/gsoc/request/' + self.org.key().name()
response = self.get(url)
self.assertRequestTemplatesUsed(response)
# test POST
override = {'status': 'pending', 'role': 'mentor', 'type': 'Request',
'user': self.data.user, 'org': self.org}
response, properties = self.modelPost(url, GSoCRequest, override)
request = GSoCRequest.all().get()
self.assertPropertiesEqual(properties, request)
self.assertEmailSent(to=admin.profile.email, n=1)
self.assertEmailNotSent(to=other_admin.profile.email)
# test withdrawing a request
url = '/gsoc/request/%s/%s/%s' % (
self.gsoc.key().name(),
request.parent_key().name(),
request.key().id())
postdata = {'action': 'Withdraw'}
response = self.post(url, postdata)
self.assertResponseRedirect(response)
request = GSoCRequest.all().get()
self.assertEqual('withdrawn', request.status)
# test that you can resubmit
postdata = {'action': 'Resubmit'}
response = self.post(url, postdata)
self.assertResponseRedirect(response)
request = GSoCRequest.all().get()
self.assertEqual('pending', request.status)
示例3: testRequestMentor
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOrgAdmin [as 别名]
def testRequestMentor(self):
admin = GSoCProfileHelper(self.gsoc, self.dev_test)
admin.createOtherUser("[email protected]")
admin.createOrgAdmin(self.org)
admin.notificationSettings(new_requests=True)
other_admin = GSoCProfileHelper(self.gsoc, self.dev_test)
other_admin.createOtherUser("[email protected]")
other_admin.createOrgAdmin(self.org)
other_admin.notificationSettings()
# test GET
self.data.createProfile()
url = "/gsoc/request/" + self.org.key().name()
response = self.get(url)
self.assertRequestTemplatesUsed(response)
# test POST
override = {"status": "pending", "role": "mentor", "type": "Request", "user": self.data.user, "org": self.org}
response, properties = self.modelPost(url, GSoCRequest, override)
request = GSoCRequest.all().get()
self.assertPropertiesEqual(properties, request)
self.assertEmailSent(to=admin.profile.email, n=1)
self.assertEmailNotSent(to=other_admin.profile.email)
# test withdrawing a request
url = "/gsoc/request/%s/%s" % (self.gsoc.key().name(), request.key().id())
postdata = {"action": "Withdraw"}
response = self.post(url, postdata)
self.assertResponseRedirect(response)
request = GSoCRequest.all().get()
self.assertEqual("withdrawn", request.status)
# test that you can resubmit
postdata = {"action": "Resubmit"}
response = self.post(url, postdata)
self.assertResponseRedirect(response)
request = GSoCRequest.all().get()
self.assertEqual("pending", request.status)