bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_shadow-utils/36-groupdel-tests

Athmane Madjoudj 536354
#!/bin/bash
Athmane Madjoudj 536354
# Author: Iain Douglas <centos@1n6.org.uk>
Athmane Madjoudj 536354
Christoph Galuschka 06c925
t_Log "Running $0"
Athmane Madjoudj 536354
Athmane Madjoudj 536354
# Check that we can delete the testgroup
Athmane Madjoudj 536354
echo "Check we can delete the group 'testgroup'"
Athmane Madjoudj 536354
Athmane Madjoudj 536354
grep -q testgroup /etc/group || { t_Log "FAIL: testgroup doesn't exist"; exit $FAIL; }
Athmane Madjoudj 536354
groupdel testgroup
Athmane Madjoudj 536354
t_CheckExitStatus $?
Athmane Madjoudj 536354
Athmane Madjoudj 536354
# Try and remove the same group shoudl fail
Athmane Madjoudj 536354
echo "Additional tests - non existent group"
Athmane Madjoudj 536354
groupdel testgroup
Athmane Madjoudj 536354
if (( $? == 6 )) 
Athmane Madjoudj 536354
then 
Athmane Madjoudj 536354
    t_Log "PASS"
Athmane Madjoudj 536354
else
Athmane Madjoudj 536354
    t_Log "Fail"
Athmane Madjoudj 536354
    exit $FAIL
Athmane Madjoudj 536354
fi
Athmane Madjoudj 536354
Athmane Madjoudj 536354
# Try and remove a user's primary group - should fail 
Athmane Madjoudj 536354
echo "Additional tests - users primary group"
Athmane Madjoudj 536354
groupdel testshadow
Athmane Madjoudj 536354
if (( $? == 8 ))
Athmane Madjoudj 536354
then
Athmane Madjoudj 536354
    t_Log "PASS"
Athmane Madjoudj 536354
else
Athmane Madjoudj 536354
    t_Log "Fail"
Athmane Madjoudj 536354
    exit $FAIL
Athmane Madjoudj 536354
fi
Athmane Madjoudj 536354