* api.2/mod-principal-v2.exp: create this file, implement tests
authorBarry Jaspan <bjaspan@mit.edu>
Mon, 21 Oct 1996 20:28:29 +0000 (20:28 +0000)
committerBarry Jaspan <bjaspan@mit.edu>
Mon, 21 Oct 1996 20:28:29 +0000 (20:28 +0000)
  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
src/lib/kadm5/unit-test/api.2/mod-principal-v2.exp [new file with mode: 0644]

index f3413bba60339d3dd3d9ea7338d62bce05f8a186..6035572a969b7ad0084346308a381e16ecd12b8b 100644 (file)
@@ -1,3 +1,8 @@
+Mon Oct 21 16:27:28 1996  Barry Jaspan  <bjaspan@mit.edu>
+
+       * 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  <bjaspan@mit.edu>
 
        * 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 (file)
index 0000000..102332d
--- /dev/null
@@ -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