View | Details | Raw Unified | Return to bug 195832
Collapse All | Expand All

(-)Makefile (-1 / +2 lines)
Lines 5-12 Link Here
5
5
6
TESTSDIR=	${TESTSBASE}/usr.sbin/pw
6
TESTSDIR=	${TESTSBASE}/usr.sbin/pw
7
7
8
ATF_TESTS_SH=	pw_delete pw_lock pw_modify pw_etcdir
8
ATF_TESTS_SH=	pw_add pw_delete pw_lock pw_modify pw_etcdir
9
9
10
TEST_METADATA.pw_add+=		required_user="root"
10
TEST_METADATA.pw_delete+=	required_user="root"
11
TEST_METADATA.pw_delete+=	required_user="root"
11
TEST_METADATA.pw_modify+=	required_user="root"
12
TEST_METADATA.pw_modify+=	required_user="root"
12
13
(-)pw_add.sh (+40 lines)
Line 0 Link Here
1
# $FreeBSD$
2
3
# Import helper functions
4
. $(atf_get_srcdir)/helper_functions.shin
5
6
# Test add user
7
atf_test_case user_add
8
user_add_body() {
9
	populate_etc_skel
10
11
	atf_check -s exit:0 ${PW} useradd test
12
	atf_check -s exit:0 -o match:"^test:.*" \
13
		grep "^test:.*" $HOME/master.passwd
14
}
15
16
17
atf_test_case user_add_comments
18
user_add_comments_body() {
19
	populate_etc_skel
20
21
	atf_check -s exit:0 ${PW} useradd test -c "Test User,work,123,456"
22
	atf_check -s exit:0 -o match:"^test:.*:Test User,work,123,456:" \
23
		grep "^test:.*:Test User,work,123,456:" $HOME/master.passwd
24
}
25
26
atf_test_case user_add_comments_invalid
27
user_add_comments_invalid_body() {
28
	populate_etc_skel
29
30
	atf_check -s exit:65 -e match:"invalid character" \
31
		${PW} useradd test -c "Test User,work,123:456,456"
32
	atf_check -s exit:1 -o empty \
33
		grep "^test:.*:Test User,work,123:456,456:" $HOME/master.passwd
34
}
35
36
atf_init_test_cases() {
37
	atf_add_test_case user_add
38
	atf_add_test_case user_add_comments
39
	atf_add_test_case user_add_comments_invalid 
40
}

Return to bug 195832