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