本文整理汇总了Python中tests.profile_utils.GSoCProfileHelper.notificationSettings方法的典型用法代码示例。如果您正苦于以下问题:Python GSoCProfileHelper.notificationSettings方法的具体用法?Python GSoCProfileHelper.notificationSettings怎么用?Python GSoCProfileHelper.notificationSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.profile_utils.GSoCProfileHelper
的用法示例。
在下文中一共展示了GSoCProfileHelper.notificationSettings方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testProposalsSubmissionLimit
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import notificationSettings [as 别名]
def testProposalsSubmissionLimit(self):
self.gsoc.apps_tasks_limit = 5
self.gsoc.put()
mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
mentor.createOtherUser('[email protected]')
mentor.createMentor(self.org)
mentor.notificationSettings(
new_proposals=True, public_comments=True, private_comments=True)
other_mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
other_mentor.createOtherUser('[email protected]')
other_mentor.createMentor(self.org)
other_mentor.notificationSettings()
self.data.createStudent()
self.data.notificationSettings()
self.timeline.studentSignup()
override = {
'program': self.gsoc, 'score': 0, 'nr_scores': 0, 'mentor': None,
'org': self.org, 'status': 'pending', 'accept_as_project': False,
'is_editable_post_deadline': False, 'extra': None, 'has_mentor': False,
}
url = '/gsoc/proposal/submit/' + self.org.key().name()
# Try to submit proposals four times.
for i in range(5):
response, properties = self.modelPost(url, GSoCProposal, override)
self.assertResponseRedirect(response)
response, properties = self.modelPost(url, GSoCProposal, override)
self.assertResponseForbidden(response)
示例2: testSubmitProposal
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import notificationSettings [as 别名]
def testSubmitProposal(self):
mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
mentor.createOtherUser('[email protected]')
mentor.createMentor(self.org)
mentor.notificationSettings(
new_proposals=True, public_comments=True, private_comments=True)
other_mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
other_mentor.createOtherUser('[email protected]')
other_mentor.createMentor(self.org)
other_mentor.notificationSettings()
self.data.createStudent()
self.data.notificationSettings()
self.timeline.studentSignup()
url = '/gsoc/proposal/submit/' + self.org.key().name()
response = self.get(url)
self.assertProposalTemplatesUsed(response)
# test proposal POST
override = {
'program': self.gsoc, 'score': 0, 'nr_scores': 0, 'mentor': None,
'org': self.org, 'status': 'pending', 'accept_as_project': False,
'is_editable_post_deadline': False, 'extra': None, 'has_mentor': False,
}
response, properties = self.modelPost(url, GSoCProposal, override)
self.assertResponseRedirect(response)
self.assertEmailSent(to=mentor.profile.email, n=1)
self.assertEmailNotSent(to=other_mentor.profile.email)
proposal = GSoCProposal.all().get()
self.assertPropertiesEqual(properties, proposal)
示例3: createStudent
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import notificationSettings [as 别名]
def createStudent(self, email, n_proposals):
"""Creates a student with proposals.
"""
student = GSoCProfileHelper(self.gsoc, self.dev_test)
student.createOtherUser(email)
student.createStudentWithProposals(self.org, self.mentor.profile,
n=n_proposals)
student.notificationSettings()
return student
示例4: testRequestMentor
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import notificationSettings [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)
示例5: testRequestMentor
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import notificationSettings [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)
示例6: testUpdateProposal
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import notificationSettings [as 别名]
def testUpdateProposal(self):
"""Test update proposals.
"""
mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
mentor.createOtherUser('[email protected]')
mentor.createMentor(self.org)
mentor.notificationSettings(proposal_updates=True)
self.data.createStudentWithProposal(self.org, mentor.profile)
self.data.notificationSettings()
self.timeline.studentSignup()
proposal = GSoCProposal.all().get()
url = '/gsoc/proposal/update/%s/%s' % (
self.gsoc.key().name(), proposal.key().id())
response = self.get(url)
self.assertProposalTemplatesUsed(response)
override = {
'program': self.gsoc, 'score': 0, 'nr_scores': 0, 'has_mentor': True,
'mentor': mentor.profile, 'org': self.org, 'status': 'pending',
'action': 'Update', 'is_publicly_visible': False, 'extra': None,
'accept_as_project': False, 'is_editable_post_deadline': False
}
response, properties = self.modelPost(url, GSoCProposal, override)
self.assertResponseRedirect(response)
properties.pop('action')
proposal = GSoCProposal.all().get()
self.assertPropertiesEqual(properties, proposal)
# after update last_modified_on should be updated which is not equal
# to created_on
self.assertNotEqual(proposal.created_on, proposal.last_modified_on)
self.assertEmailSent(to=mentor.profile.email, n=1)
示例7: createMentorWithSettings
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import notificationSettings [as 别名]
def createMentorWithSettings(self, email, notification_settings={}):
mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
mentor.createOtherUser(email)
mentor.createMentor(self.org)
mentor.notificationSettings(**notification_settings)
return mentor
示例8: testInviteOrgAdmin
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import notificationSettings [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)
示例9: AcceptProposalsTest
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import notificationSettings [as 别名]
class AcceptProposalsTest(MailTestCase, GSoCDjangoTestCase, TaskQueueTestCase):
"""Tests for accept_proposals task.
"""
ACCEPT_URL = '/tasks/gsoc/accept_proposals/accept'
REJECT_URL = '/tasks/gsoc/accept_proposals/reject'
MAIN_URL = '/tasks/gsoc/accept_proposals/main'
def setUp(self):
super(AcceptProposalsTest, self).setUp()
self.init()
self.createHost()
self.createMentor()
self.acceptProposals()
def createHost(self):
"""Sets program host.
"""
self.host = self.data
self.host.createHost()
self.host.createProfile()
def createMentor(self):
"""Creates a mentor for organization.
"""
self.mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
self.mentor.createOtherUser('[email protected]')
self.mentor.createMentor(self.org)
self.mentor.notificationSettings()
def createStudent(self, email, n_proposals):
"""Creates a student with proposals.
"""
student = GSoCProfileHelper(self.gsoc, self.dev_test)
student.createOtherUser(email)
student.createStudentWithProposals(self.org, self.mentor.profile,
n=n_proposals)
student.notificationSettings()
return student
def acceptProposals(self):
"""Set student proposals' acceptance state and make sure the organization
has slots available.
"""
self.student1 = self.createStudent('[email protected]',
n_proposals=2)
self.student1_proposals = GSoCProposal.all().ancestor(
self.student1.profile)
self.student2 = self.createStudent('[email protected]',
n_proposals=3)
self.student2_proposals = GSoCProposal.all().ancestor(
self.student2.profile)
self.assertEqual(self.student1_proposals.count(), 2)
self.assertEqual(self.student2_proposals.count(), 3)
#accept 1 of 2 proposal of student1
proposal1 = self.student1_proposals[0]
proposal1.accept_as_project = True
proposal1.put()
proposal2 = self.student1_proposals[1]
proposal2.accept_as_project = False
proposal2.put()
#reject all proposals of student2
for proposal in self.student2_proposals:
proposal.accept_as_project = False
proposal.put()
self.org.slots = 5
self.org.put()
self.timeline.studentsAnnounced()
def testConvertProposals(self):
"""Tests convert proposal task runs successfully.
"""
post_data = {'program_key': self.gsoc.key().name()}
response = self.post(self.MAIN_URL, post_data)
self.assertEqual(response.status_code, httplib.OK)
#assert accept task started for first org
self.assertTasksInQueue(n=1, url=self.ACCEPT_URL)
#assert main task started for next org
self.assertTasksInQueue(n=1, url=self.MAIN_URL)
#assert parameters to tasks
for task in self.get_tasks():
if task['url'] == self.ACCEPT_URL:
expected_params = {'org_key':
urllib.quote_plus(self.org.key().id_or_name())}
self.assertEqual(expected_params, task['params'])
elif task['url'] == self.MAIN_URL:
q = GSoCOrganization.all()
q.filter('scope', self.gsoc)
q.filter('status', 'active')
#.........这里部分代码省略.........