Account lockout
[krb5.git] / src / lib / kadm5 / unit-test / api.3 / destroy.exp
1 load_lib lib.t
2 api_exit
3 api_start
4
5 test "destroy 1"
6
7 proc test1 {} {
8         global test
9         begin_dump
10         if {! [cmd {
11             kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
12                 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
13                 server_handle
14         }]} {
15                 perror "$test: unexpected failure in init"
16                 return
17         }
18         one_line_succeed_test {kadm5_destroy $server_handle}
19         end_dump_compare "no-diffs"
20 }
21 test1
22
23 #test "destroy 2"
24 #
25 #proc test2 {} {
26 #       global test
27 #       begin_dump
28 #       if {! [cmd {
29 #           kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
30 #                   $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
31 #                   server_handle
32 #       }]} {
33 #           perror "$test: unexpected failure on init"
34 #           return
35 #       }
36 #       if {! [cmd {kadm5_destroy $server_handle}]} {
37 #               error_and_restart "$test: couldn't close database"
38 #               return
39 #       }
40 #       one_line_fail_test \
41 #               {kadm5_get_principal $server_handle admin principal} \
42 #               "NOT_INIT"
43 #       end_dump_compare "no-diffs"
44 #}
45 #test2
46
47 #test "destroy 3"
48 #proc test3 {} {
49 #       global test
50 #
51 #       begin_dump
52 #       if {! (( ! [principal_exists "$test/a"]) || [delete_principal "$test/a"])} {
53 #           error_and_restart "$test couldn't delete principal \"$test/a\""
54 #           return
55 #       }
56 #       if {! [cmd {
57 #           kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
58 #                   $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
59 #                   server_handle
60 #       }]} {
61 #           perror "$test: unexpected failure on init"
62 #           return
63 #       }
64 #       if {! [cmd {kadm5_destroy $server_handle}]} {
65 #               error_and_restart "$test: couldn't close database"
66 #               return
67 #       }
68 #       one_line_fail_test [format {
69 #           kadm5_create_principal $server_handle \
70 #                   [simple_principal "%s/a"] {KADM5_PRINCIPAL} "%s/a"
71 #       } $test $test] "NOT_INIT"
72 #       end_dump_compare "no-diffs"
73 #}
74 #test3
75
76 #test "destroy 4"
77 #proc test4 {} {
78 #       global test prompt
79 #
80 #       if {! (([principal_exists "$test/a"]) || [create_principal "$test/a"])} {
81 #               error_and_restart "$test: couldn't create principal \"$test/a\""
82 #               return
83 #       }
84 #       begin_dump
85 #       if {! ([cmd {
86 #           kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
87 #                   $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
88 #                   server_handle
89 #       }] &&
90 #           [cmd [format {
91 #               kadm5_get_principal $server_handle "%s/a" principal
92 #           } $test]])} {
93 #               error_and_restart "$test: error getting principal"
94 #               return;
95 #       }
96 #       if {! [cmd {kadm5_destroy $server_handle}]} {
97 #               error_and_restart "$test: couldn't close database"
98 #               return
99 #       }
100 #       one_line_fail_test [format {
101 #           kadm5_modify_principal $server_handle \
102 #                   {"%s/a" 0 0 0 0 0 0 0 %d 0 0 0} {KADM5_KVNO}
103 #       } $test "77"] "NOT_INIT"
104 #       end_dump_compare "no-diffs"
105 #}
106 #test4
107
108 #test "destroy 5"
109 #
110 #proc test5 {} {
111 #       global test
112 #
113 #       if {! ([principal_exists "$test/a"] || [create_principal "$test/a"])} {
114 #               error_and_restart "$test: couldn't create principal \"$test/a\""
115 #               return
116 #       }
117 #       begin_dump
118 #       if {! [cmd {
119 #           kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
120 #                   $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
121 #                   server_handle
122 #       }]} {
123 #           perror "$test: unexpected failure on init"
124 #           return
125 #       }
126 #       if {! [cmd {kadm5_destroy $server_handle}]} {
127 #               error_and_restart "$test: couldn't close database"
128 #               return
129 #       }
130 #       one_line_fail_test [format {
131 #           kadm5_delete_principal $server_handle "%s/a"
132 #       } $test] "NOT_INIT"
133 #       end_dump_compare "no-diffs"
134 #}
135 #test5
136
137 #test   "destroy 6"
138 #
139 #proc test6 {} {
140 #       global test
141 #       begin_dump      
142 #       one_line_fail_test {kadm5_destroy $server_handle} "NOT_INIT"
143 #       end_dump_compare "no-diffs"     
144 #}
145 #test6
146
147
148 #test   "destroy 7"
149 #
150 #proc test7 {} {
151 #       global test
152 #       begin_dump      
153 #       if {! [cmd {
154 #           kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
155 #                   $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
156 #                   server_handle
157 #       }]} {
158 #               perror "$test: unexpected failure in init"
159 #               return
160 #       }
161 #       if {! [cmd {kadm5_destroy $server_handle}]} {
162 #               error_and_restart "$test: couldn't close database"
163 #       }
164 #       one_line_fail_test {kadm5_destroy $server_handle} "NOT_INIT"
165 #       end_dump_compare "no-diffs"     
166 #}
167 #test7
168
169 test    "destroy 8"
170 proc test8 {} {
171         global test
172         begin_dump      
173         if {! [cmd {
174             kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
175                     $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
176                     server_handle
177         }]} {
178                 perror "$test: unexpected failure in init"
179                 return
180         }
181         if {! [cmd {kadm5_destroy $server_handle}]} {
182                 error_and_restart "$test: couldn't close database"
183         }
184         one_line_succeed_test {
185             kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
186                     $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
187                     server_handle
188         }
189         if {! [cmd {kadm5_destroy $server_handle}]} {
190                 error_and_restart "$test: couldn't close database"
191         }
192         end_dump_compare "no-diffs"             
193 }
194 test8
195
196 test "destroy 9"
197 proc test9 {} {
198         global test
199         one_line_fail_test {kadm5_destroy null} "BAD_SERVER_HANDLE"
200 }
201 test9
202
203 return ""