diff options
Diffstat (limited to 'tests/useradd.test')
-rwxr-xr-x | tests/useradd.test | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/useradd.test b/tests/useradd.test index 90b65019..d0b68ee6 100755 --- a/tests/useradd.test +++ b/tests/useradd.test @@ -21,83 +21,83 @@ arg="&>/dev/null" pass=`echo -ne 'password\npassword\n'` user="toyTestUser" -testing "useradd (text)" "useradd $user $arg || +testing "(text)" "useradd $user $arg || grep '^$user:' /etc/passwd $arg && [ -d /home/$user ] && echo 'yes'" "yes\n" "" "$pass" userdel -r $user $arg user="toy1Test2User3" -testing "useradd (alphanumeric)" "useradd $user $arg || +testing "(alphanumeric)" "useradd $user $arg || grep '^$user:' /etc/passwd $arg && [ -d /home/$user ] && echo 'yes'" "yes\n" "" "$pass" userdel -r $user $arg user="987654321" -testing "useradd (numeric)" "useradd $user $arg || +testing "(numeric)" "useradd $user $arg || grep '^$user:' /etc/passwd $arg && [ -d /home/$user ] && echo 'yes'" "yes\n" "" "$pass" userdel -r $user $arg user="toy.1Test-2User_3" -testing "useradd (with ./-/_)" "useradd $user $arg || +testing "(with ./-/_)" "useradd $user $arg || grep '^$user:' /etc/passwd $arg && [ -d /home/$user ] && echo 'yes'" "yes\n" "" "$pass" userdel -r $user $arg # 70 characters long string; hereafter, we will use it as per our need. user="abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789" -testing "useradd (long string)" "useradd $user $arg || +testing "(long string)" "useradd $user $arg || grep '^$user:' /etc/passwd $arg && [ -d /home/$user ] && echo 'yes'" "yes\n" "" "$pass" userdel -r $user $arg user="toyTestUser" -testing "useradd dir" "useradd -h $PWD/dir $user $arg || +testing "dir" "useradd -h $PWD/dir $user $arg || grep '^$user:.*dir' /etc/passwd $arg && [ -d $PWD/dir ] && echo 'yes'" "yes\n" "" "$pass" userdel -r $user $arg rm -rf $PWD/dir gecos="aaa,bbb,ccc,ddd,eee" -testing "useradd gecos" "useradd -g '$gecos' $user $arg || +testing "gecos" "useradd -g '$gecos' $user $arg || grep '^$user:.*$gecos' /etc/passwd $arg && [ -d /home/$user ] && echo 'yes'" "yes\n" "" "$pass" userdel -r $user $arg shl="/bin/sh" -testing "useradd shell" "useradd -s $shl $user $arg || +testing "shell" "useradd -s $shl $user $arg || grep '^$user:.*$shl$' /etc/passwd $arg && [ -d /home/$user ] && echo 'yes'" "yes\n" "" "$pass" userdel -r $user $arg g_name="root" g_id=`grep $g_name':.*:.*' /etc/group | cut -d : -f 3` -testing "useradd group" "useradd -G $g_name $user $arg || +testing "group" "useradd -G $g_name $user $arg || grep '^$user:.*:.*:$g_id:.*' /etc/passwd $arg && [ -d /home/$user ] && echo 'yes'" "yes\n" "" "$pass" userdel -r $user $arg -testing "useradd (system user)" "useradd -S $user $arg || +testing "(system user)" "useradd -S $user $arg || grep '^$user:.*:.*:.*' /etc/passwd $arg && [ ! -e /home/$user ] && echo 'yes'" "yes\n" "" "$pass" userdel -r $user $arg -testing "useradd -D" "useradd -D $user $arg || +testing "-D" "useradd -D $user $arg || grep '^$user:.*:.*:.*' /etc/passwd $arg && [ -d /home/$user ] && echo 'yes'" "yes\n" "" "$pass" userdel -r $user $arg -testing "useradd -H" "useradd -H $user $arg || +testing "-H" "useradd -H $user $arg || grep '^$user:.*:.*:.*' /etc/passwd $arg && [ ! -e /home/$user ] && echo 'yes'" "yes\n" "" "$pass" userdel -r $user $arg -testing "useradd dir and -H" "useradd -H -h $PWD/dir $user $arg || +testing "dir and -H" "useradd -H -h $PWD/dir $user $arg || grep '^$user:.*dir' /etc/passwd $arg && [ ! -e $PWD/dir ] && echo 'yes'" "yes\n" "" "$pass" userdel -r $user $arg -testing "useradd -u" "useradd -u 49999 $user $arg || +testing "-u" "useradd -u 49999 $user $arg || grep '^$user:x:49999:.*' /etc/passwd $arg && [ -d /home/$user ] && echo 'yes'" "yes\n" "" "$pass" userdel -r $user $arg |