summaryrefslogtreecommitdiffstats
path: root/pw/tests/pw_lock.sh
blob: 070a6f914396dc5e80afde6235f29fab9ca9407f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# $FreeBSD$

# Import helper functions
. $(atf_get_srcdir)/helper_functions.shin

# Test locking and unlocking a user account
atf_test_case user_locking cleanup
user_locking_body() {
	populate_etc_skel
	pw -V ${HOME} useradd test || atf_fail "Creating test user"
	pw -V ${HOME} lock test || atf_fail "Locking the user"
	atf_check -s exit:0 -o match:"^test:\*LOCKED\*\*:1001:" \
		grep "^test:\*LOCKED\*\*:1001:" $HOME/master.passwd
	pw -V ${HOME} unlock test || atf_fail "Locking the user"
	atf_check -s exit:0 -o match:"^test:\*:1001:" \
		grep "^test:\*:1001:" $HOME/master.passwd
}


atf_init_test_cases() {
	atf_add_test_case user_locking
}