本文整理汇总了Python中tests.profile_utils.GSoCProfileHelper.createOtherUser方法的典型用法代码示例。如果您正苦于以下问题:Python GSoCProfileHelper.createOtherUser方法的具体用法?Python GSoCProfileHelper.createOtherUser怎么用?Python GSoCProfileHelper.createOtherUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.profile_utils.GSoCProfileHelper
的用法示例。
在下文中一共展示了GSoCProfileHelper.createOtherUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testAcceptProposalButton
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [as 别名]
def testAcceptProposalButton(self):
student = GSoCProfileHelper(self.gsoc, self.dev_test)
student.createOtherUser('[email protected]')
student.createStudent()
proposal = self.createProposal({'scope': student.profile,
'parent': student.profile})
suffix = "%s/%s/%d" % (
self.gsoc.key().name(),
student.user.key().name(),
proposal.key().id())
self.data.createMentor(self.org)
url = '/gsoc/proposal/accept/' + suffix
postdata = {'value': 'unchecked'}
response = self.post(url, postdata)
# fail if mentor tries to accept the proposal
self.assertResponseForbidden(response)
proposal = GSoCProposal.all().get()
self.assertFalse(proposal.accept_as_project)
# accept the proposal as project when the org admin tries to accept
# the proposal
self.data.createOrgAdmin(self.org)
response = self.post(url, postdata)
self.assertResponseOK(response)
proposal = GSoCProposal.all().get()
self.assertTrue(proposal.accept_as_project)
示例2: testFeaturedProjectButton
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [as 别名]
def testFeaturedProjectButton(self):
self.timeline.studentsAnnounced()
student = GSoCProfileHelper(self.gsoc, self.dev_test)
student.createOtherUser('[email protected]')
student.createStudent()
self.data.createOrgAdmin(self.org)
mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
mentor.createOtherUser('[email protected]')
mentor_entity = mentor.createMentor(self.org)
project = self.createProject({'parent': self.data.profile,
'mentor': mentor_entity})
suffix = "%s/%s/%d" % (
self.gsoc.key().name(),
self.data.user.key().name(),
project.key().id())
url = '/gsoc/project/featured/' + suffix
postdata = {'value': 'unchecked'}
response = self.post(url, postdata)
self.assertResponseOK(response)
project = GSoCProject.all().get()
self.assertEqual(project.is_featured, True)
示例3: testWithdrawProjects
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [as 别名]
def testWithdrawProjects(self):
self.data.createHost()
self.timeline.studentsAnnounced()
url = '/gsoc/withdraw_projects/' + self.gsoc.key().name()
response = self.get(url)
self.assertWithdrawProjects(response)
# list response without any projects
response = self.getListResponse(url, 0)
self.assertIsJsonResponse(response)
data = response.context['data']['']
self.assertEqual(0, len(data))
# list response with projects
mentor_profile_helper = GSoCProfileHelper(self.gsoc, self.dev_test)
mentor_profile_helper.createOtherUser('[email protected]')
mentor = mentor_profile_helper.createMentor(self.org)
self.data.createStudentWithProposal(self.org, mentor)
self.data.createStudentWithProject(self.org, mentor)
response = self.getListResponse(url, 0)
self.assertIsJsonResponse(response)
data = response.context['data']['']
self.assertEqual(1, len(data))
示例4: createMentor
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [as 别名]
def createMentor(self, email, organization):
"""Creates a mentor for the given organization.
"""
profile_helper = GSoCProfileHelper(self.program, dev_test=False)
profile_helper.createOtherUser(email)
mentor = profile_helper.createMentor(organization)
return mentor
示例5: testTakeEvalForStudentProjectWithAnotherOrg
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [as 别名]
def testTakeEvalForStudentProjectWithAnotherOrg(self):
url, eval, _ = self.getStudentEvalRecordProperties()
other_org = self.createOrg()
mentor_profile = GSoCProfileHelper(self.gsoc, self.dev_test)
mentor_profile.createOtherUser('[email protected]')
mentor = mentor_profile.createMentor(other_org)
self.data.createStudentWithProject(other_org, mentor)
# test student evaluation show GET for a for a student who
# has another project in a different organization
response = self.get(url)
self.assertResponseForbidden(response)
project = GSoCProject.all().get()
suffix = "%s/%s/%s/%s" % (
self.gsoc.key().name(), eval.link_id,
project.parent().link_id, project.key().id())
base_url = '/gsoc/eval/student'
self.ffPastEval(eval)
response = self.get(url)
show_url = '%s/show/%s' % (base_url, suffix)
self.assertResponseRedirect(response, show_url)
示例6: createOrgAdmin
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [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
示例7: testTakeEvalForStudent
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [as 别名]
def testTakeEvalForStudent(self):
eval = self.evaluation.createStudentEvaluation()
mentor_profile = GSoCProfileHelper(self.gsoc, self.dev_test)
mentor_profile.createOtherUser('[email protected]')
mentor = mentor_profile.createMentor(self.org)
self.data.createStudentWithProject(self.org, mentor)
project = GSoCProject.all().get()
base_url = '/gsoc/eval/student'
suffix = "%s/%s/%s/%s" % (
self.gsoc.key().name(), eval.link_id,
project.parent().link_id, project.key().id())
url = '%s/%s' % (base_url, suffix)
# test student evaluation show GET for a for a student who
# has another project in a different organization
response = self.get(url)
self.assertEvaluationTakeTemplateUsed(response)
self.assertContains(response, '%s' % (eval.title))
self.assertContains(response, 'Project: %s' % (project.title))
self.assertEqual(response.context['page_name'],
'%s' % (eval.title))
form = response.context['forms'][0]
self.assertFormFromSchema(form, eval.schema)
postdata = {
'frm-t1309871149671-item': 'one line text message',
'frm-t1309871322655-item': ['Option 2', 'Option 3'],
'frm-t1309871157535-item': """A quick brown fox jumped over a lazy dog.
A quick brown fox jumped over a lazy dog. A quick brown fox jumped
over a lazy dog. A quick brown fox jumped over a lazy dog.""",
}
response = self.post(url, postdata)
self.assertResponseOK(response)
self.assertFormError(
response, 'form', 'frm-t1310822212610-item',
'This field is required.')
postdata = {
'frm-t1309871149671-item': 'one line text message',
'frm-t1309871322655-item': ['Option 2', 'Option 3'],
'frm-t1309871157535-item': """A quick brown fox jumped over a lazy dog.
A quick brown fox jumped over a lazy dog. A quick brown fox jumped
over a lazy dog. A quick brown fox jumped over a lazy dog.""",
'frm-t1310822212610-item': "Wa Wa",
}
response = self.post(url, postdata)
self.assertResponseRedirect(response, '%s?validated' % (url,))
self.ffPastEval(eval)
response = self.get(url)
show_url = '%s/show/%s' % (base_url, suffix)
self.assertResponseRedirect(response, show_url)
示例8: testSubmitProposal
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [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)
示例9: testProposalsSubmissionLimit
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [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)
示例10: testShowEvalForStudent
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [as 别名]
def testShowEvalForStudent(self):
eval = self.evaluation.createStudentEvaluation()
mentor_profile = GSoCProfileHelper(self.gsoc, self.dev_test)
mentor_profile.createOtherUser('[email protected]')
mentor = mentor_profile.createMentor(self.org)
self.data.createStudentWithProject(self.org, mentor)
project = GSoCProject.all().get()
suffix = "%s/%s/%s/%s" % (
self.gsoc.key().name(), eval.link_id,
project.parent().link_id, project.key().id())
url = '/gsoc/eval/student/show/%s' % (suffix,)
# test student evaluation show GET for a for a student who
# has another project in a different organization
response = self.get(url)
self.assertEvaluationShowTemplateUsed(response)
self.ffPastEval(eval)
response = self.get(url)
self.assertEvaluationShowTemplateUsed(response)
示例11: createStudent
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [as 别名]
def createStudent(self):
"""Creates a Student with a project.
"""
profile_helper = GSoCProfileHelper(self.gsoc, self.dev_test)
profile_helper.createOtherUser('[email protected]')
self.student = profile_helper.createStudentWithProject(self.org,
self.mentor)
self.project = GSoCProject.all().ancestor(self.student).get()
示例12: testDashboardAsStudentWithProject
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [as 别名]
def testDashboardAsStudentWithProject(self):
mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
mentor.createOtherUser('[email protected]').createMentor(self.org)
self.data.createStudentWithProject(self.org, mentor.profile)
url = '/gsoc/dashboard/' + self.gsoc.key().name()
response = self.get(url)
self.assertDashboardComponentTemplatesUsed(response)
response = self.getListResponse(url, 2)
self.assertIsJsonResponse(response)
示例13: createStudent
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [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
示例14: createRequest
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [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)
示例15: createStudentProjects
# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createOtherUser [as 别名]
def createStudentProjects(self):
"""Creates two student projects.
"""
from soc.modules.gsoc.models.student_project import StudentProject
mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
mentor.createOtherUser('[email protected]').createMentor(self.org)
student = GSoCProfileHelper(self.gsoc, self.dev_test)
student.createOtherUser('[email protected]')
student.createStudentWithProjects(self.org, mentor.profile, 2)