本文整理汇总了Python中tests.profile_utils.GSoCProfileHelper类的典型用法代码示例。如果您正苦于以下问题:Python GSoCProfileHelper类的具体用法?Python GSoCProfileHelper怎么用?Python GSoCProfileHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GSoCProfileHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: createOrgAdmin
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
开发者ID:adviti,项目名称:melange,代码行数:7,代码来源:test_profile.py
示例2: ProjectListTest
class ProjectListTest(GSoCDjangoTestCase):
"""Tests project list page.
"""
def setUp(self):
self.init()
def assertProjectTemplatesUsed(self, response):
"""Asserts that all the templates from the dashboard were used.
"""
self.assertGSoCTemplatesUsed(response)
self.assertTemplateUsed(response, "v2/modules/gsoc/projects_list/base.html")
self.assertTemplateUsed(response, "v2/modules/gsoc/projects_list/_project_list.html")
def testListProjects(self):
self.timeline.studentsAnnounced()
url = "/gsoc/projects/list/" + self.gsoc.key().name()
response = self.get(url)
self.assertProjectTemplatesUsed(response)
response = self.getListResponse(url, 0)
self.assertIsJsonResponse(response)
data = response.context["data"][""]
self.assertEqual(0, len(data))
self.mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
self.mentor.createMentor(self.org)
self.data.createStudentWithProject(self.org, self.mentor.profile)
response = self.getListResponse(url, 0)
self.assertIsJsonResponse(response)
data = response.context["data"][""]
self.assertEqual(1, len(data))
开发者ID:praveen97uma,项目名称:GSoC-Docs,代码行数:32,代码来源:test_project_list.py
示例3: testTakeEvalForStudentProjectWithAnotherOrg
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)
开发者ID:adviti,项目名称:melange,代码行数:26,代码来源:test_student_evaluation.py
示例4: testShowEvalForStudent
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)
开发者ID:adviti,项目名称:melange,代码行数:25,代码来源:test_student_evaluation.py
示例5: testTakeEvalForStudent
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)
开发者ID:adviti,项目名称:melange,代码行数:60,代码来源:test_student_evaluation.py
示例6: testAcceptProposalButton
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)
开发者ID:adviti,项目名称:melange,代码行数:33,代码来源:test_proposal_review.py
示例7: createMentor
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
开发者ID:adviti,项目名称:melange,代码行数:7,代码来源:test_profile.py
示例8: testWithdrawProjects
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))
开发者ID:adviti,项目名称:melange,代码行数:25,代码来源:test_withdraw_projects.py
示例9: testInviteOrgAdmin
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,代码行数:29,代码来源:test_invite.py
示例10: createStudent
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()
开发者ID:adviti,项目名称:melange,代码行数:8,代码来源:test_survey_reminders.py
示例11: testDashboardAsStudentWithProject
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)
开发者ID:praveen97uma,项目名称:GSoC-Docs,代码行数:9,代码来源:test_dashboard.py
示例12: testDashboardAsMentorWithProject
def testDashboardAsMentorWithProject(self):
self.timeline.studentsAnnounced()
student = GSoCProfileHelper(self.gsoc, self.dev_test)
student.createOtherUser('[email protected]').createStudent()
self.data.createMentorWithProject(self.org, student.profile)
url = '/gsoc/dashboard/' + self.gsoc.key().name()
response = self.get(url)
self.assertDashboardComponentTemplatesUsed(response)
response = self.getListResponse(url, 4)
self.assertIsJsonResponse(response)
开发者ID:praveen97uma,项目名称:GSoC-Docs,代码行数:10,代码来源:test_dashboard.py
示例13: testFeaturedProjectButton
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)
开发者ID:adviti,项目名称:melange,代码行数:29,代码来源:test_project_details.py
示例14: ProjectsPageTest
class ProjectsPageTest(GSoCDjangoTestCase):
"""Test projects list for admin
"""
def setUp(self):
self.init()
def assertProjectsPage(self, response):
"""Asserts that all the templates from the accepted projects list were used
and all contexts were passed.
"""
self.assertTrue('base_layout' in response.context)
self.assertTrue('cbox' in response.context)
if response.context['cbox']:
self.assertGSoCColorboxTemplatesUsed(response)
self.assertEqual(response.context['base_layout'],
'v2/modules/gsoc/base_colorbox.html')
else:
self.assertGSoCTemplatesUsed(response)
self.assertEqual(response.context['base_layout'],
'v2/modules/gsoc/base.html')
self.assertTemplateUsed(response, 'v2/modules/gsoc/admin/list.html')
self.assertTemplateUsed(response,
'v2/modules/gsoc/admin/_projects_list.html')
def testListProjects(self):
self.data.createHost()
self.timeline.studentsAnnounced()
url = '/gsoc/admin/projects/' + self.org.key().name()
response = self.get(url)
self.assertProjectsPage(response)
response = self.getListResponse(url, 0)
self.assertIsJsonResponse(response)
data = response.context['data']['']
self.assertEqual(0, len(data))
# test list with student's proposal
self.mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
self.mentor.createMentor(self.org)
self.data.createStudentWithProjects(self.org, self.mentor.profile, 1)
response = self.getListResponse(url, 0)
self.assertIsJsonResponse(response)
data = response.context['data']['']
self.assertEqual(1, len(data))
# rendered inside cbox iframe
url += '?cbox=true'
response = self.get(url)
self.assertProjectsPage(response)
开发者ID:praveen97uma,项目名称:GSoC-Docs,代码行数:52,代码来源:test_admin.py
示例15: testCreateEvaluationForMentor
def testCreateEvaluationForMentor(self):
link_id = LinkIDProvider(ProjectSurvey).getValue()
suffix = "%s/%s" % (self.gsoc.key().name(), link_id)
student_profile = GSoCProfileHelper(self.gsoc, self.dev_test)
student_profile.createOtherUser('[email protected]')
student = student_profile.createStudent()
self.data.createMentorWithProject(self.org, student)
# test review GET
url = '/gsoc/eval/student/edit/' + suffix
response = self.get(url)
self.assertResponseForbidden(response)
开发者ID:adviti,项目名称:melange,代码行数:13,代码来源:test_student_evaluation.py
示例16: createMentor
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()
开发者ID:adviti,项目名称:melange,代码行数:7,代码来源:test_accept_proposals.py
示例17: testListProjects
def testListProjects(self):
self.data.createHost()
self.timeline.studentsAnnounced()
url = '/gsoc/admin/projects/' + self.org.key().name()
response = self.get(url)
self.assertProjectsPage(response)
response = self.getListResponse(url, 0)
self.assertIsJsonResponse(response)
data = response.context['data']['']
self.assertEqual(0, len(data))
# test list with student's proposal
self.mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
self.mentor.createMentor(self.org)
self.data.createStudentWithProjects(self.org, self.mentor.profile, 1)
response = self.getListResponse(url, 0)
self.assertIsJsonResponse(response)
data = response.context['data']['']
self.assertEqual(1, len(data))
# rendered inside cbox iframe
url += '?cbox=true'
response = self.get(url)
self.assertProjectsPage(response)
开发者ID:praveen97uma,项目名称:GSoC-Docs,代码行数:26,代码来源:test_admin.py
示例18: testShowEvalForStudentProjectWithAnotherOrg
def testShowEvalForStudentProjectWithAnotherOrg(self):
url, eval, _ = self.getStudentEvalRecordProperties(show=True)
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)
self.ffPastEval(eval)
response = self.get(url)
self.assertResponseForbidden(response)
开发者ID:adviti,项目名称:melange,代码行数:17,代码来源:test_student_evaluation.py
示例19: testShowEvalForStudentProjectWithAnotherMentor
def testShowEvalForStudentProjectWithAnotherMentor(self):
url, eval, _ = self.getStudentEvalRecordProperties(show=True)
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)
# test student evaluation show GET for a for a student who
# has another project whose mentor is different than the current
# mentor but the project is in the same org
response = self.get(url)
self.assertResponseForbidden(response)
self.ffPastEval(eval)
response = self.get(url)
self.assertResponseForbidden(response)
开发者ID:adviti,项目名称:melange,代码行数:17,代码来源:test_student_evaluation.py
示例20: createStudentProjects
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)
开发者ID:adviti,项目名称:melange,代码行数:10,代码来源:test_org_home.py
注:本文中的tests.profile_utils.GSoCProfileHelper类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论