summaryrefslogtreecommitdiffstats
path: root/src/lib/kadm5/unit-test/api.2/get-policy.exp
blob: 83aef80e8f6c755321b6eaa990b9a9ff5e1e0e4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
load_lib lib.t
api_exit
api_start

test "get-policy 3"
proc test3 {} {
    global test
#    set prms_id 744
#    setup_xfail {*-*-*} $prms_id

    if {! [cmd {
	kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
	    $KADM5_STRUCT_VERSION $KADM5_API_VERSION_2 \
	server_handle
    }]} {
	perror "$test: unexpected failure in init"
	return
    }
    one_line_fail_test {kadm5_get_policy $server_handle "" p} "BAD_POLICY"
    if { ! [cmd {kadm5_destroy $server_handle}]} {
	perror "$test: unexpected failure in destroy"
	return
    }
}
test3

test "get-policy 6"
proc test6 {} {
    global test

    if {! [cmd {
	kadm5_init admin/none admin $KADM5_ADMIN_SERVICE null \
	    $KADM5_STRUCT_VERSION $KADM5_API_VERSION_2 \
	    server_handle
    }]} {
	perror "$test: unexpected failure in init"
	return
    }
    one_line_fail_test {kadm5_get_policy $server_handle test-pol p} \
	    "AUTH_GET"
    if { ! [cmd {kadm5_destroy $server_handle}]} {
	perror "$test: unexpected failure in destroy"
	return
    }
}
if { $RPC } test6

test "get-policy 7"
proc test7 {} {
    global test

    if {! [cmd {
	kadm5_init admin/add admin $KADM5_ADMIN_SERVICE null \
	    $KADM5_STRUCT_VERSION $KADM5_API_VERSION_2 \
	    server_handle
    }]} {
	perror "$test: unexpected failure in init"
	return
    }
    one_line_fail_test {kadm5_get_policy $server_handle test-pol p} \
	    "AUTH_GET"
    if { ! [cmd {kadm5_destroy $server_handle}]} {
	perror "$test: unexpected failure in destroy"
	return
    }
}
if { $RPC } test7

test "get-policy 11"
proc test11 {} {
    global test

    if {! [cmd {
	kadm5_init admin/get-pol StupidAdmin $KADM5_ADMIN_SERVICE \
		null $KADM5_STRUCT_VERSION $KADM5_API_VERSION_2 \
		server_handle
    }]} {
	perror "$test: unexpected failure in init"
	return
    }
    one_line_succeed_test {kadm5_get_policy $server_handle test-pol p}
    if { ! [cmd {kadm5_destroy $server_handle}]} {
	perror "$test: unexpected failure in destroy"
	return
    }
}
test11

test "get-policy 12"
proc test12 {} {
    global test

    if {! [cmd {
	kadm5_init admin/get-pol StupidAdmin \
		$KADM5_CHANGEPW_SERVICE null $KADM5_STRUCT_VERSION \
		$KADM5_API_VERSION_2 server_handle
    }]} {
	perror "$test: unexpected failure in init"
	return
    }
    one_line_succeed_test \
	    {kadm5_get_policy $server_handle test-pol-nopw p}
    if { ! [cmd {kadm5_destroy $server_handle}]} {
	perror "$test: unexpected failure in destroy"
	return
    }
}
test12

test "get-policy 15"
proc test15 {} {
    global test

    if {! [cmd {
	kadm5_init admin/pol StupidAdmin $KADM5_ADMIN_SERVICE null \
		$KADM5_STRUCT_VERSION $KADM5_API_VERSION_2 \
		server_handle
    }]} {
	perror "$test: unexpected failure in init"
	return
    }
    one_line_succeed_test \
	    {kadm5_get_policy $server_handle test-pol-nopw p}
    if { ! [cmd {kadm5_destroy $server_handle}]} {
	perror "$test: unexpected failure in destroy"
	return
    }
}
test15

test "get-policy 16"
proc test16 {} {
    global test

    if {! [cmd {
	kadm5_init admin/pol StupidAdmin $KADM5_CHANGEPW_SERVICE \
		null $KADM5_STRUCT_VERSION $KADM5_API_VERSION_2 \
		server_handle
    }]} {
	perror "$test: unexpected failure in init"
	return
    }
    one_line_succeed_test \
	    {kadm5_get_policy $server_handle test-pol-nopw p}
    if { ! [cmd {kadm5_destroy $server_handle}]} {
	perror "$test: unexpected failure in destroy"
	return
    }
}
test16

test "get-policy 17"
proc test17 {} {
    global test

    if {! [cmd {
	kadm5_init admin/get admin $KADM5_ADMIN_SERVICE null \
	    $KADM5_STRUCT_VERSION $KADM5_API_VERSION_2 \
	    server_handle
    }]} {
	perror "$test: unexpected failure in init"
	return
    }
    one_line_succeed_test {kadm5_get_policy $server_handle test-pol p}
    if { ! [cmd {kadm5_destroy $server_handle}]} {
	perror "$test: unexpected failure in destroy"
	return
    }
}
test17

test "get-policy 18"
proc test18 {} {
    global test

    if {! [cmd {
	kadm5_init admin/get admin $KADM5_CHANGEPW_SERVICE null \
		$KADM5_STRUCT_VERSION $KADM5_API_VERSION_2 \
		server_handle
    }]} {
	perror "$test: unexpected failure in init"
	return
    }
    one_line_fail_test {kadm5_get_policy $server_handle test-pol p} \
	    "AUTH_GET"
    if { ! [cmd {kadm5_destroy $server_handle}]} {
	perror "$test: unexpected failure in destroy"
	return
    }
}
if { $RPC } test18

test "get-policy 21"
proc test21 {} {
    global test

    one_line_fail_test {kadm5_get_policy null "pol1" p} "BAD_SERVER_HANDLE"
}
test21