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


Python GSoCProfileHelper.createMentor方法代码示例

本文整理汇总了Python中tests.profile_utils.GSoCProfileHelper.createMentor方法的典型用法代码示例。如果您正苦于以下问题:Python GSoCProfileHelper.createMentor方法的具体用法?Python GSoCProfileHelper.createMentor怎么用?Python GSoCProfileHelper.createMentor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tests.profile_utils.GSoCProfileHelper的用法示例。


在下文中一共展示了GSoCProfileHelper.createMentor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testSubmitProposal

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [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)
开发者ID:praveen97uma,项目名称:GSoC-Docs,代码行数:35,代码来源:test_proposal.py

示例2: testProposalsSubmissionLimit

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [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)
开发者ID:praveen97uma,项目名称:GSoC-Docs,代码行数:36,代码来源:test_proposal.py

示例3: ProjectListTest

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [as 别名]
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,代码行数:34,代码来源:test_project_list.py

示例4: ProjectsPageTest

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [as 别名]
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,代码行数:54,代码来源:test_admin.py

示例5: testTakeEvalForStudent

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [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)
开发者ID:adviti,项目名称:melange,代码行数:62,代码来源:test_student_evaluation.py

示例6: createMentor

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [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
开发者ID:adviti,项目名称:melange,代码行数:9,代码来源:test_profile.py

示例7: testShowEvalForStudent

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [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)
开发者ID:adviti,项目名称:melange,代码行数:27,代码来源:test_student_evaluation.py

示例8: testFeaturedProjectButton

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [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)
开发者ID:adviti,项目名称:melange,代码行数:31,代码来源:test_project_details.py

示例9: testTakeEvalForStudentProjectWithAnotherOrg

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [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)
开发者ID:adviti,项目名称:melange,代码行数:28,代码来源:test_student_evaluation.py

示例10: testWithdrawProjects

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [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))
开发者ID:adviti,项目名称:melange,代码行数:27,代码来源:test_withdraw_projects.py

示例11: testCreateEvaluationForStudent

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [as 别名]
  def testCreateEvaluationForStudent(self):
    link_id = LinkIDProvider(ProjectSurvey).getValue()
    suffix = "%s/%s" % (self.gsoc.key().name(), link_id)

    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 review GET
    url = '/gsoc/eval/student/edit/' + suffix
    response = self.get(url)
    self.assertResponseForbidden(response)
开发者ID:adviti,项目名称:melange,代码行数:15,代码来源:test_student_evaluation.py

示例12: testUpdateProposal

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [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)
开发者ID:praveen97uma,项目名称:GSoC-Docs,代码行数:40,代码来源:test_proposal.py

示例13: testShowEvalForStudentProjectWithAnotherOrg

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [as 别名]
  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,代码行数:19,代码来源:test_student_evaluation.py

示例14: testShowEvalForStudentProjectWithAnotherMentor

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [as 别名]
  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,代码行数:19,代码来源:test_student_evaluation.py

示例15: testProjectDetails

# 需要导入模块: from tests.profile_utils import GSoCProfileHelper [as 别名]
# 或者: from tests.profile_utils.GSoCProfileHelper import createMentor [as 别名]
  def testProjectDetails(self):
    self.data.createStudent()
    self.timeline.studentsAnnounced()

    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())

    # test project details GET
    url = '/gsoc/project/' + suffix
    response = self.get(url)
    self.assertProjectDetailsTemplateUsed(response)
开发者ID:adviti,项目名称:melange,代码行数:22,代码来源:test_project_details.py


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