From 902a534f9ab52f34356f0b7b2278e52bb9ff429e Mon Sep 17 00:00:00 2001 From: Barry Jaspan Date: Mon, 21 Oct 1996 20:28:29 +0000 Subject: [PATCH] * api.2/mod-principal-v2.exp: create this file, implement tests 100-104 [krb5-admin/20] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9219 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kadm5/unit-test/ChangeLog | 5 + .../unit-test/api.2/mod-principal-v2.exp | 102 ++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 src/lib/kadm5/unit-test/api.2/mod-principal-v2.exp diff --git a/src/lib/kadm5/unit-test/ChangeLog b/src/lib/kadm5/unit-test/ChangeLog index f3413bba6..6035572a9 100644 --- a/src/lib/kadm5/unit-test/ChangeLog +++ b/src/lib/kadm5/unit-test/ChangeLog @@ -1,3 +1,8 @@ +Mon Oct 21 16:27:28 1996 Barry Jaspan + + * api.2/mod-principal-v2.exp: create this file, implement tests + 100-104 [krb5-admin/20] + Fri Oct 18 13:21:08 1996 Barry Jaspan * api.2/init-v2.exp: add test 117, for default max_life diff --git a/src/lib/kadm5/unit-test/api.2/mod-principal-v2.exp b/src/lib/kadm5/unit-test/api.2/mod-principal-v2.exp new file mode 100644 index 000000000..102332dba --- /dev/null +++ b/src/lib/kadm5/unit-test/api.2/mod-principal-v2.exp @@ -0,0 +1,102 @@ +load_lib lib.t +api_exit +api_start + +test "modify-principal 100-104" +proc test100_104 {} { + global test + global prompt + + if {! (( [principal_exists "$test/a"]) || + [create_principal "$test/a"])} { + error_and_restart "$test: couldn't create principal \"$test/a\"" + return + } + + if {! [cmd { + kadm5_init admin admin $KADM5_CHANGEPW_SERVICE null \ + $KADM5_STRUCT_VERSION $KADM5_API_VERSION_2 \ + server_handle + }]} { + error "$test: unexpected failure in init" + return + } + + # test 100 + one_line_succeed_test [format { + kadm5_modify_principal $server_handle [simple_principal "%s/a"] \ + {KADM5_MAX_RLIFE} + } $test] + + # test 101 + one_line_fail_test { + kadm5_modify_principal $server_handle null \ + {KADM5_LAST_SUCCESS} + } "BAD_MASK" + # test 102 + one_line_fail_test { + kadm5_modify_principal $server_handle null \ + {KADM5_LAST_FAILED} + } "BAD_MASK" + # test 103 + one_line_fail_test { + kadm5_modify_principal $server_handle null \ + {KADM5_FAIL_AUTH_COUNT} + } "BAD_MASK" + # test 103.5 + one_line_fail_test { + kadm5_modify_principal $server_handle null \ + {KADM5_KEY_DATA} + } "BAD_MASK" + + # test 100,104 + if { ! [cmd [format { + kadm5_modify_principal $server_handle \ + "{%s/a} 0 0 0 0 {%s/a} 0 0 0 0 null 0 88 0 0 0 0 1 {} {{999 6 foobar}}" \ + {KADM5_MAX_RLIFE KADM5_TL_DATA} + } $test $test]]} { + fail "$test: cannot set MAX_RLIFE or TL_DATA" + return + } + if {! [cmd [format { + kadm5_get_principal $server_handle "%s/a" principal {KADM5_PRINCIPAL_NORMAL_MASK KADM5_TL_DATA} + } $test]]} { + error_and_restart "$test: could not retrieve principal" + return + } + send "lindex \$principal 12\n" + expect { + -re "(\[0-9\]+)\n$prompt$" {set rlife $expect_out(1,string) } + timeout { + error_and_restart "$test: timeout getting rlife" + return + } + eof { + error_and_restart "$test: eof getting rlife" + return + } + } + send "lindex \$principal 19\n" + expect { + -re "\(\{.*\}\)\n$prompt$" {set tl $expect_out(1,string) } + timeout { + error_and_restart "$test: timeout getting tl_data" + return + } + eof { + error_and_restart "$test: eof getting tl_data" + return + } + } + if {($rlife == 88) && ([string match "*{999 6 foobar}*" $tl])} { + pass "$test" + } else { + fail "$test: $rlife should be 88, $tl should contain {999 6 foobar}" + } + + if { ! [cmd {kadm5_destroy $server_handle}]} { + error "$test: unexpected failure in destroy" + return + } +} +test100_104 -- 2.26.2