Exemple #1
0
    def testForLoneUser(self):
        user = profile_utils.seedNDBUser()
        profile_utils.loginNDB(user)

        project = _createProjectForMentor(self.gsoc, self.org, self.dev_test)

        kwargs = {
            'sponsor': self.sponsor.link_id,
            'program': self.program.program_id,
            'user': user.user_id,
            'id': project.key().id(),
        }
        data = request_data.RequestData(None, None, kwargs)

        self.assertFalse(project_details._isUpdateLinkVisible(data))
  def testForLoneUser(self):
    user = profile_utils.seedNDBUser()
    profile_utils.loginNDB(user)

    project = _createProjectForMentor(self.gsoc, self.org, self.dev_test)

    kwargs = {
        'sponsor': self.sponsor.link_id,
        'program': self.program.program_id,
        'user': user.user_id,
        'id': project.key().id(),
        }
    data = request_data.RequestData(None, None, kwargs)

    self.assertFalse(project_details._isUpdateLinkVisible(data))
  def testForOtherStudent(self):
    user = profile_utils.seedNDBUser()
    profile_utils.loginNDB(user)
    profile_utils.seedSOCStudent(self.program, user=user)

    project = _createProjectForStudent(self.gsoc, self.org, self.dev_test)

    sponsor_id, program_id, user_id = project.parent_key().name().split('/')
    kwargs = {
        'sponsor': sponsor_id,
        'program': program_id,
        'user': user_id,
        'id': project.key().id(),
        }
    data = request_data.RequestData(None, None, kwargs)

    self.assertFalse(project_details._isUpdateLinkVisible(data))
Exemple #4
0
    def testForOtherStudent(self):
        user = profile_utils.seedNDBUser()
        profile_utils.loginNDB(user)
        profile_utils.seedSOCStudent(self.program, user=user)

        project = _createProjectForStudent(self.gsoc, self.org, self.dev_test)

        sponsor_id, program_id, user_id = project.parent_key().name().split(
            '/')
        kwargs = {
            'sponsor': sponsor_id,
            'program': program_id,
            'user': user_id,
            'id': project.key().id(),
        }
        data = request_data.RequestData(None, None, kwargs)

        self.assertFalse(project_details._isUpdateLinkVisible(data))
  def testForProjectOrgAdmin(self):
    user = profile_utils.seedNDBUser()
    profile_utils.loginNDB(user)
    profile_utils.seedNDBProfile(
        self.program.key(), user=user, admin_for=[self.org.key])

    project = _createProjectForMentor(self.program, self.org, self.dev_test)

    sponsor_id, program_id, user_id = project.parent_key().name().split('/')
    kwargs = {
        'sponsor': sponsor_id,
        'program': program_id,
        'user': user_id,
        'id': project.key().id(),
        }
    data = request_data.RequestData(None, None, kwargs)

    self.assertTrue(project_details._isUpdateLinkVisible(data))
Exemple #6
0
    def testForProjectOrgAdmin(self):
        user = profile_utils.seedNDBUser()
        profile_utils.loginNDB(user)
        profile_utils.seedNDBProfile(self.program.key(),
                                     user=user,
                                     admin_for=[self.org.key])

        project = _createProjectForMentor(self.program, self.org,
                                          self.dev_test)

        sponsor_id, program_id, user_id = project.parent_key().name().split(
            '/')
        kwargs = {
            'sponsor': sponsor_id,
            'program': program_id,
            'user': user_id,
            'id': project.key().id(),
        }
        data = request_data.RequestData(None, None, kwargs)

        self.assertTrue(project_details._isUpdateLinkVisible(data))
Exemple #7
0
 def testForHost(self):
     data = request_data.RequestData(None, None, None)
     data._program = self.program
     data._ndb_user = profile_utils.seedNDBUser(host_for=[self.program])
     result = project_details._isUpdateLinkVisible(data)
     self.assertTrue(result)
 def testForHost(self):
   data = request_data.RequestData(None, None, None)
   data._program = self.program
   data._ndb_user = profile_utils.seedNDBUser(host_for=[self.program])
   result = project_details._isUpdateLinkVisible(data)
   self.assertTrue(result)