[28655] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Test err_fmt

daemon@ATHENA.MIT.EDU (Greg Hudson)
Sun Dec 7 23:38:17 2014

Date: Sun, 7 Dec 2014 23:35:31 -0500
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201412080435.sB84ZVQZ001776@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/aa39669d6e9d2f300777ba7cf8409ed7ef2ce2f7
commit aa39669d6e9d2f300777ba7cf8409ed7ef2ce2f7
Author: Nicolas Williams <nico@cryptonector.com>
Date:   Mon Nov 10 20:43:12 2014 -0600

    Test err_fmt
    
    [ghudson@mit.edu: move tests to new file; stop messing with
    KRB5CCNAME; use K5Realm.special_env instead of multiple K5Realm
    objects]
    
    ticket: 8047

 src/tests/Makefile.in |    1 +
 src/tests/t_errmsg.py |   28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/tests/Makefile.in b/src/tests/Makefile.in
index 34816e3..6fdbbef 100644
--- a/src/tests/Makefile.in
+++ b/src/tests/Makefile.in
@@ -141,6 +141,7 @@ check-pytests:: t_init_creds t_localauth unlockiter
 	$(RUNPYTEST) $(srcdir)/t_kdc_log.py $(PYTESTFLAGS)
 	$(RUNPYTEST) $(srcdir)/t_proxy.py $(PYTESTFLAGS)
 	$(RUNPYTEST) $(srcdir)/t_unlockiter.py $(PYTESTFLAGS)
+	$(RUNPYTEST) $(srcdir)/t_errmsg.py $(PYTESTFLAGS)
 
 clean::
 	$(RM) gcred hist hrealm kdbtest plugorder rdreq responder s2p
diff --git a/src/tests/t_errmsg.py b/src/tests/t_errmsg.py
new file mode 100644
index 0000000..ca78d0f
--- /dev/null
+++ b/src/tests/t_errmsg.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+from k5test import *
+
+realm = K5Realm(create_kdb=False)
+
+# Test err_fmt, using klist -c to induce errors.
+fmt1 = 'FOO Error: %M (see http://localhost:1234/%C for more information)'
+conf1 = {'libdefaults': {'err_fmt': fmt1}}
+e1 = realm.special_env('fmt1', False, krb5_conf=conf1)
+out = realm.run([klist, '-c', 'testdir/xx/yy'], env=e1, expected_code=1)
+if out != ("klist: FOO Error: Credentials cache file 'testdir/xx/yy' not "
+           "found (see http://localhost:1234/-1765328189 for more "
+           "information)\n"):
+    fail('err_fmt expansion failed')
+conf2 = {'libdefaults': {'err_fmt': '%M - %C'}}
+e2 = realm.special_env('fmt2', False, krb5_conf=conf2)
+out = realm.run([klist, '-c', 'testdir/xx/yy'], env=e2, expected_code=1)
+if out != ("klist: Credentials cache file 'testdir/xx/yy' not found - "
+           "-1765328189\n"):
+    fail('err_fmt expansion failed')
+conf3 = {'libdefaults': {'err_fmt': '%%%M %-% %C%'}}
+e3 = realm.special_env('fmt3', False, krb5_conf=conf3)
+out = realm.run([klist, '-c', 'testdir/xx/yy'], env=e3, expected_code=1)
+if out != ("klist: %Credentials cache file 'testdir/xx/yy' not found %-% "
+           "-1765328189%\n"):
+    fail('err_fmt expansion failed')
+
+success('error message tests')
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post