Пример #1
0
    def testDashboardAsHost(self):
        self.data.createHost()
        mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
        mentor.createOtherUser('*****@*****.**').createMentor(self.org)
        student = GSoCProfileHelper(self.gsoc, self.dev_test)
        student.createOtherUser('*****@*****.**')
        student.createStudentWithProject(self.org, mentor.profile)

        url = '/gsoc/dashboard/' + self.gsoc.key().name()
        response = self.get(url)
        self.assertDashboardTemplatesUsed(response)
Пример #2
0
  def testDashboardAsHost(self):
    self.data.createHost()
    mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
    mentor.createOtherUser('*****@*****.**').createMentor(self.org)
    student = GSoCProfileHelper(self.gsoc, self.dev_test)
    student.createOtherUser('*****@*****.**')
    student.createStudentWithProject(self.org, mentor.profile)

    url = '/gsoc/dashboard/' + self.gsoc.key().name()
    response = self.get(url)
    self.assertDashboardTemplatesUsed(response)
Пример #3
0
    def testOnlyAHostCanAccessTheAdminProfilePage(self):
        """Tests that only the host is allowed to access profile pages.
    """
        mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
        mentor.createOtherUser('*****@*****.**').createMentor(self.org)
        student = GSoCProfileHelper(self.gsoc, self.dev_test)
        student.createOtherUser('*****@*****.**')
        student.createStudentWithProject(self.org, mentor.profile)

        url = '/gsoc/profile/admin/' + student.profile.key().name()

        self.data.createStudent()
        response = self.get(url)
        self.assertResponseForbidden(response)

        self.data.deleteProfile().createMentor(self.org)
        response = self.get(url)
        self.assertResponseForbidden(response)

        self.data.createOrgAdmin(self.org)
        response = self.get(url)
        self.assertResponseForbidden(response)

        self.data.deleteProfile().createProfile()
        self.data.createHost()

        response = self.get(url)
        self.assertResponseOK(response)
        self.assertProfileShowPageTemplatesUsed(response)

        context = response.context
        self.assertTrue('page_name' in context)
        self.assertTrue('program_name' in context)
        self.assertTrue('profile' in context)
        self.assertTrue('user' in context)
        self.assertTrue('links' in context)
        self.assertTrue('css_prefix' in context)
        self.assertTrue('submit_tax_link' in context)
        self.assertTrue('submit_enrollment_link' in context)

        self.assertEqual(1, len(context['links']))

        expected_page_name = '%s Profile - %s' % (self.data.program.short_name,
                                                  student.profile.name())
        actual_page_name = context['page_name']
        self.assertEqual(expected_page_name, actual_page_name)

        expected_program_name = self.data.program.name
        actual_program_name = context['program_name']
        self.assertEqual(expected_program_name, actual_program_name)
Пример #4
0
  def testOnlyAHostCanAccessTheAdminProfilePage(self):
    """Tests that only the host is allowed to access profile pages.
    """
    mentor = GSoCProfileHelper(self.gsoc, self.dev_test)
    mentor.createOtherUser('*****@*****.**').createMentor(self.org)
    student = GSoCProfileHelper(self.gsoc, self.dev_test)
    student.createOtherUser('*****@*****.**')
    student.createStudentWithProject(self.org, mentor.profile)

    url = '/gsoc/profile/admin/' + student.profile.key().name()

    self.data.createStudent()
    response = self.get(url)
    self.assertResponseForbidden(response)

    self.data.deleteProfile().createMentor(self.org)
    response = self.get(url)
    self.assertResponseForbidden(response)
    
    self.data.createOrgAdmin(self.org)
    response = self.get(url)
    self.assertResponseForbidden(response)

    self.data.deleteProfile().createProfile()
    self.data.createHost()

    response = self.get(url)
    self.assertResponseOK(response)
    self.assertProfileShowPageTemplatesUsed(response)

    context = response.context
    self.assertTrue('page_name' in context)
    self.assertTrue('program_name' in context)
    self.assertTrue('profile' in context)
    self.assertTrue('user' in context)
    self.assertTrue('links' in context)
    self.assertTrue('css_prefix' in context)
    self.assertTrue('submit_tax_link' in context)
    self.assertTrue('submit_enrollment_link' in context)

    self.assertEqual(1, len(context['links']))
    
    expected_page_name = '%s Profile - %s' % (self.data.program.short_name, 
                                              student.profile.name())
    actual_page_name = context['page_name']
    self.assertEqual(expected_page_name, actual_page_name)
    
    expected_program_name = self.data.program.name
    actual_program_name = context['program_name']
    self.assertEqual(expected_program_name, actual_program_name)
 def createStudent(self):
     """Creates a Student with a project.
 """
     profile_helper = GSoCProfileHelper(self.gsoc, self.dev_test)
     profile_helper.createOtherUser('*****@*****.**')
     self.student = profile_helper.createStudentWithProject(
         self.org, self.mentor)
     self.project = GSoCProject.all().ancestor(self.student).get()
Пример #6
0
 def createStudent(self):
   """Creates a Student with a project.
   """
   profile_helper = GSoCProfileHelper(self.gsoc, self.dev_test)
   profile_helper.createOtherUser('*****@*****.**')
   self.student = profile_helper.createStudentWithProject(self.org,
                                                          self.mentor)
   self.project = GSoCProject.all().ancestor(self.student).get()
Пример #7
0
  def getStudentEvalRecordProperties(self, show=False):
    eval = self.evaluation.createStudentEvaluation()

    mentor_profile = GSoCProfileHelper(self.gsoc, self.dev_test)
    mentor_profile.createOtherUser('*****@*****.**')
    mentor = mentor_profile.createMentor(self.org)

    student_profile = GSoCProfileHelper(self.gsoc, self.dev_test)
    student_profile.createOtherUser('*****@*****.**')
    student_profile.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())

    base_url = '/gsoc/eval/student'
    if show:
      url = '%s/show/%s' % (base_url, suffix)
    else:
      url = '%s/%s' % (base_url, suffix)

    return (url, eval, mentor)