Skip to content

Commit 785f08f

Browse files
Add tests for the new functionality
1 parent 844a442 commit 785f08f

9 files changed

Lines changed: 77 additions & 0 deletions

File tree

linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_password_warn_age_login_defs/tests/bad_value.fail.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash
22

3+
if [ -e {{{ login_defs_drop_in_path }}} ] ; then
4+
rm {{{ login_defs_drop_in_path }}}
5+
fi
6+
37
grep -q "^PASS_WARN_AGE" {{{ login_defs_path }}} && \
48
sed -i "s/PASS_WARN_AGE.*/PASS_WARN_AGE\t0/g" {{{ login_defs_path }}}
59
if ! [ $? -eq 0 ]; then

linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_password_warn_age_login_defs/tests/commented.fail.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash
22

3+
if [ -e {{{ login_defs_drop_in_path }}} ] ; then
4+
rm {{{ login_defs_drop_in_path }}}
5+
fi
6+
37
grep -q "^PASS_WARN_AGE" {{{ login_defs_path }}} && \
48
sed -i "s/PASS_WARN_AGE.*/# PASS_WARN_AGE\t7/g" {{{ login_defs_path }}}
59
if ! [ $? -eq 0 ]; then

linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_password_warn_age_login_defs/tests/correct.pass.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash
22

3+
if [ -e {{{ login_defs_drop_in_path }}} ] ; then
4+
rm {{{ login_defs_drop_in_path }}}
5+
fi
6+
37
grep -q "^PASS_WARN_AGE" {{{ login_defs_path }}} && \
48
sed -i "s/PASS_WARN_AGE.*/PASS_WARN_AGE\t7/g" {{{ login_defs_path }}}
59
if ! [ $? -eq 0 ]; then

linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_password_warn_age_login_defs/tests/disabled.fail.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
if [ -e {{{ login_defs_drop_in_path }}} ] ; then
4+
rm {{{ login_defs_drop_in_path }}}
5+
fi
36
grep -q "^PASS_WARN_AGE" {{{ login_defs_path }}} && \
47
sed -i "s/PASS_WARN_AGE.*/PASS_WARN_AGE\t-1/g" {{{ login_defs_path }}}
58
if ! [ $? -eq 0 ]; then
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
# platform = SUSE Linux Enterprise 16
3+
# variables = var_accounts_password_warn_age_login_defs=7
4+
5+
if [ -e {{{ login_defs_drop_in_path }}} ] ; then
6+
rm {{{ login_defs_drop_in_path }}}
7+
fi
8+
{{{ bash_copy_distro_defaults(login_defs_defaults_path, login_defs_path) }}}
9+
10+
if grep -q "^PASS_WARN_AGE" {{{ login_defs_path }}} ; then
11+
sed -i "s/PASS_WARN_AGE.*/PASS_WARN_AGE 0/g" {{{ login_defs_path }}}
12+
else
13+
echo "PASS_WARN_AGE 0" >> {{{ login_defs_path }}}
14+
fi
15+
echo "PASS_WARN_AGE 7" >> {{{ login_defs_drop_in_path }}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
# platform = SUSE Linux Enterprise 16
3+
# variables = var_accounts_password_warn_age_login_defs=7
4+
5+
if [ -e {{{ login_defs_drop_in_path }}} ] ; then
6+
rm {{{ login_defs_drop_in_path }}}
7+
fi
8+
{{{ bash_copy_distro_defaults(login_defs_defaults_path, login_defs_path) }}}
9+
10+
if grep -q "^PASS_WARN_AGE" {{{ login_defs_path }}} ; then
11+
sed -i "s/PASS_WARN_AGE.*/PASS_WARN_AGE 0/g" {{{ login_defs_path }}}
12+
else
13+
echo "PASS_WARN_AGE 0" >> {{{ login_defs_path }}}
14+
fi
15+
echo "PASS_WARN_AGE 7" >> {{{ login_defs_drop_in_path }}}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
#!/bin/bash
22

3+
if [ -e {{{ login_defs_drop_in_path }}} ] ; then
4+
rm {{{ login_defs_drop_in_path }}}
5+
fi
6+
{{{ bash_copy_distro_defaults(login_defs_defaults_path, login_defs_path) }}}
37
sed -i "/PASS_WARN_AGE.*/d" {{{ login_defs_path }}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# platform = SUSE Linux Enterprise 16
3+
# variables = var_accounts_password_warn_age_login_defs=7
4+
5+
if [ -e {{{ login_defs_drop_in_path }}} ] ; then
6+
rm {{{ login_defs_drop_in_path }}}
7+
fi
8+
{{{ bash_copy_distro_defaults(login_defs_defaults_path, login_defs_path) }}}
9+
if grep -q "^PASS_WARN_AGE" {{{ login_defs_path }}} ; then
10+
sed -i "s/PASS_WARN_AGE.*/PASS_WARN_AGE 7/g" {{{ login_defs_path }}}
11+
else
12+
echo "PASS_WARN_AGE 7" >> {{{ login_defs_path }}}
13+
fi
14+
echo "PASS_WARN_AGE 0" >> "/etc/login.defs.d/user.dropin.defs"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# platform = SUSE Linux Enterprise 16
3+
# variables = var_accounts_password_warn_age_login_defs=7
4+
5+
if [ -e {{{ login_defs_drop_in_path }}} ] ; then
6+
rm {{{ login_defs_drop_in_path }}}
7+
fi
8+
{{{ bash_copy_distro_defaults(login_defs_defaults_path, login_defs_path) }}}
9+
if grep -q "^PASS_WARN_AGE" {{{ login_defs_path }}} ; then
10+
sed -i "s/PASS_WARN_AGE.*/PASS_WARN_AGE 7/g" {{{ login_defs_path }}}
11+
else
12+
echo "PASS_WARN_AGE 7" >> {{{ login_defs_path }}}
13+
fi
14+
echo "PASS_WARN_AGE 0" >> {{{ login_defs_drop_in_path }}}

0 commit comments

Comments
 (0)