Esempio n. 1
0
  def testForMentorThatCanResign(self, mock_func):
    """Tests for a user who is a mentor that can currently resign."""
    # make profile a mentor for organization
    self.profile.is_mentor = True
    self.profile.mentor_for = [self.org.key()]

    result = profile_logic.isNoRoleEligibleForOrg(self.profile, self.org.key())
    self.assertTrue(result)
Esempio n. 2
0
    def testForMentorThatCanResign(self, mock_func):
        """Tests for a user who is a mentor that can currently resign."""
        # make profile a mentor for organization
        self.profile.is_mentor = True
        self.profile.mentor_for = [self.org.key()]

        result = profile_logic.isNoRoleEligibleForOrg(self.profile,
                                                      self.org.key())
        self.assertTrue(result)
Esempio n. 3
0
  def testForOrgAdminThatCannotResign(self, mock_func):
    """Tests for u user who is an org admin that cannot currently resign."""
    # make profile an administrator for organization
    self.profile.is_mentor = True
    self.profile.mentor_for = [self.org.key()]
    self.profile.is_org_admin = True
    self.profile.org_admin_for = [self.org.key()]

    result = profile_logic.isNoRoleEligibleForOrg(self.profile, self.org.key())
    self.assertFalse(result)
Esempio n. 4
0
    def testForOrgAdminThatCannotResign(self, mock_func):
        """Tests for u user who is an org admin that cannot currently resign."""
        # make profile an administrator for organization
        self.profile.is_mentor = True
        self.profile.mentor_for = [self.org.key()]
        self.profile.is_org_admin = True
        self.profile.org_admin_for = [self.org.key()]

        result = profile_logic.isNoRoleEligibleForOrg(self.profile,
                                                      self.org.key())
        self.assertFalse(result)
Esempio n. 5
0
    def testForOrgAdminThatCanResign(self, mock_func):
        """Tests for u user who is an org admin that can currently resign."""
        # make profile an administrator for organization
        self.profile.is_mentor = True
        self.profile.mentor_for = [self.org.key()]
        self.profile.is_org_admin = True
        self.profile.org_admin_for = [self.org.key()]

        # profile cannot resign as mentor, though
        with mock.patch.object(profile_logic,
                               'canResignAsMentorForOrg',
                               return_value=rich_bool.FALSE):
            result = profile_logic.isNoRoleEligibleForOrg(
                self.profile, self.org.key())
            self.assertFalse(result)

        # now, profile can resign as mentor
        with mock.patch.object(profile_logic,
                               'canResignAsMentorForOrg',
                               return_value=rich_bool.TRUE):
            result = profile_logic.isNoRoleEligibleForOrg(
                self.profile, self.org.key())
            self.assertTrue(result)
Esempio n. 6
0
  def testForOrgAdminThatCanResign(self, mock_func):
    """Tests for u user who is an org admin that can currently resign."""
    # make profile an administrator for organization
    self.profile.is_mentor = True
    self.profile.mentor_for = [self.org.key()]
    self.profile.is_org_admin = True
    self.profile.org_admin_for = [self.org.key()]

    # profile cannot resign as mentor, though
    with mock.patch.object(
        profile_logic, 'canResignAsMentorForOrg',
        return_value=rich_bool.FALSE):
      result = profile_logic.isNoRoleEligibleForOrg(
          self.profile, self.org.key())
      self.assertFalse(result)

    # now, profile can resign as mentor
    with mock.patch.object(
        profile_logic, 'canResignAsMentorForOrg',
        return_value=rich_bool.TRUE):
      result = profile_logic.isNoRoleEligibleForOrg(
          self.profile, self.org.key())
      self.assertTrue(result)
Esempio n. 7
0
 def testForNoRole(self):
     """Tests for a user who does not have a role with organization."""
     result = profile_logic.isNoRoleEligibleForOrg(self.profile,
                                                   self.org.key())
     self.assertTrue(result)
Esempio n. 8
0
 def testForNoRole(self):
   """Tests for a user who does not have a role with organization."""
   result = profile_logic.isNoRoleEligibleForOrg(self.profile, self.org.key())
   self.assertTrue(result)