Exemple #1
0
    def test_clear_posix_group(self):
        """Test PosixGroup modification"""
        self.assertTrue(utils.group_exists(self.posix_group))
        # Ensure that there are no members in the group (posixGroup has no
        # minimum number of members, so there should be no members upon
        # creation of the group):
        self.assertTrue(len(utils.get_group_members(self.posix_group)) == 0)

        # Add the user to the group:
        self.assertTrue(utils.mod_user_group(
            self.user, self.posix_group, action=MOD_ADD))
        # Ensure that there is now 1 member:
        self.assertTrue(len(utils.get_group_members(self.posix_group)) == 1)

        # Clear the group (removes the user):
        self.assertTrue(utils.clear_group_members(self.posix_group))
        # Group size should be 0 again:
        self.assertTrue(len(utils.get_group_members(self.posix_group)) == 0)
Exemple #2
0
    def test_clear_posix_group(self):
        """Test PosixGroup modification"""
        self.assertTrue(utils.group_exists(self.posix_group))
        # Ensure that there are no members in the group (posixGroup has no
        # minimum number of members, so there should be no members upon
        # creation of the group):
        self.assertTrue(len(utils.get_group_members(self.posix_group)) == 0)

        # Add the user to the group:
        self.assertTrue(
            utils.mod_user_group(self.user, self.posix_group, action=MOD_ADD))
        # Ensure that there is now 1 member:
        self.assertTrue(len(utils.get_group_members(self.posix_group)) == 1)

        # Clear the group (removes the user):
        self.assertTrue(utils.clear_group_members(self.posix_group))
        # Group size should be 0 again:
        self.assertTrue(len(utils.get_group_members(self.posix_group)) == 0)
Exemple #3
0
    def test_clear_group_of_names(self):
        """Test GroupOfNames modification"""
        self.assertTrue(utils.group_exists(self.group_of_names))
        # Ensure the there is only 1 member in the group (which should be the
        # default user), since this group is a groupOfNames object, requiring
        # at least 1 member):
        self.assertTrue(len(utils.get_group_members(self.group_of_names)) == 1)

        # Add the user to the group:
        self.assertTrue(
            utils.mod_user_group(self.user,
                                 self.group_of_names,
                                 action=MOD_ADD))
        # Ensure that there are now 2 members:
        self.assertTrue(len(utils.get_group_members(self.group_of_names)) == 2)

        # Clear the group (remove the user):
        self.assertTrue(utils.clear_group_members(self.group_of_names))
        # Group size should be 1 again, since default user should still be
        # left when clearing groupOfNames:
        self.assertTrue(len(utils.get_group_members(self.group_of_names)) == 1)
Exemple #4
0
    def test_clear_group_of_names(self):
        """Test GroupOfNames modification"""
        self.assertTrue(utils.group_exists(self.group_of_names))
        # Ensure the there is only 1 member in the group (which should be the
        # default user), since this group is a groupOfNames object, requiring
        # at least 1 member):
        self.assertTrue(
            len(utils.get_group_members(self.group_of_names)) == 1)

        # Add the user to the group:
        self.assertTrue(utils.mod_user_group(
            self.user, self.group_of_names, action=MOD_ADD))
        # Ensure that there are now 2 members:
        self.assertTrue(
            len(utils.get_group_members(self.group_of_names)) == 2)

        # Clear the group (remove the user):
        self.assertTrue(utils.clear_group_members(self.group_of_names))
        # Group size should be 1 again, since default user should still be
        # left when clearing groupOfNames:
        self.assertTrue(
            len(utils.get_group_members(self.group_of_names)) == 1)