From: Robbie Harwood Date: Wed, 15 Feb 2017 02:22:43 +0000 (-0500) Subject: Increase use of expected_msg in GSS tests X-Git-Tag: krb5-1.20-beta1~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b170a1814413cbc515f9322483851a4ac5012b7;p=thirdparty%2Fkrb5.git Increase use of expected_msg in GSS tests This prevents additional debugging output from breaking the tests, and reduces collision with k5test.py's output(). --- diff --git a/src/tests/gssapi/t_credstore.py b/src/tests/gssapi/t_credstore.py index 9be57bb82f..f666e5e207 100644 --- a/src/tests/gssapi/t_credstore.py +++ b/src/tests/gssapi/t_credstore.py @@ -50,10 +50,9 @@ else: mark('rcache') # t_credstore -r should produce a replay error normally, but not with # rcache set to "none:". -output = realm.run(['./t_credstore', '-r', '-a', 'p:' + realm.host_princ], - expected_code=1) -if 'gss_accept_sec_context(2): Request is a replay' not in output: - fail('Expected replay error not seen in t_credstore output') +realm.run(['./t_credstore', '-r', '-a', 'p:' + realm.host_princ], + expected_code=1, + expected_msg='gss_accept_sec_context(2): Request is a replay') realm.run(['./t_credstore', '-r', '-a', 'p:' + realm.host_princ, 'rcache', 'none:']) diff --git a/src/tests/gssapi/t_gssapi.py b/src/tests/gssapi/t_gssapi.py index e22cec427f..1740a6177a 100755 --- a/src/tests/gssapi/t_gssapi.py +++ b/src/tests/gssapi/t_gssapi.py @@ -86,9 +86,9 @@ realm.run(['./t_imp_cred', 'p:service2/dwight'], expected_code=1, # Verify that we can't acquire acceptor creds without a keytab. os.remove(realm.keytab) -output = realm.run(['./t_accname', 'p:abc'], expected_code=1) -if ('gss_acquire_cred: Keytab' not in output or - 'nonexistent or empty' not in output): +out = realm.run(['./t_accname', 'p:abc'], expected_code=1) +if ('gss_acquire_cred: Keytab' not in out or + 'nonexistent or empty' not in out): fail('Expected error message not seen for nonexistent keytab') realm.stop() @@ -143,23 +143,18 @@ shutil.copyfile(realm.keytab, realm.client_keytab) realm.run(['./t_inq_cred', '-k', '-b'], expected_msg=realm.host_princ) # Test gss_export_name behavior. -out = realm.run(['./t_export_name', 'u:x']) -if out != '0401000B06092A864886F7120102020000000D78404B5242544553542E434F4D\n': - fail('Unexpected output from t_export_name (krb5 username)') -output = realm.run(['./t_export_name', '-s', 'u:xyz']) -if output != '0401000806062B06010505020000000378797A\n': - fail('Unexpected output from t_export_name (SPNEGO username)') -output = realm.run(['./t_export_name', 'p:a@b']) -if output != '0401000B06092A864886F71201020200000003614062\n': - fail('Unexpected output from t_export_name (krb5 principal)') -output = realm.run(['./t_export_name', '-s', 'p:a@b']) -if output != '0401000806062B060105050200000003614062\n': - fail('Unexpected output from t_export_name (SPNEGO krb5 principal)') +realm.run(['./t_export_name', 'u:x'], expected_msg=\ + '0401000B06092A864886F7120102020000000D78404B5242544553542E434F4D\n') +realm.run(['./t_export_name', '-s', 'u:xyz'], + expected_msg='0401000806062B06010505020000000378797A\n') +realm.run(['./t_export_name', 'p:a@b'], + expected_msg='0401000B06092A864886F71201020200000003614062\n') +realm.run(['./t_export_name', '-s', 'p:a@b'], + expected_msg='0401000806062B060105050200000003614062\n') # Test that composite-export tokens can be imported. -output = realm.run(['./t_export_name', '-c', 'p:a@b']) -if (output != '0402000B06092A864886F7120102020000000361406200000000\n'): - fail('Unexpected output from t_export_name (using COMPOSITE_EXPORT)') +realm.run(['./t_export_name', '-c', 'p:a@b'], expected_msg= + '0402000B06092A864886F7120102020000000361406200000000\n') # Test gss_inquire_mechs_for_name behavior. krb5_mech = '{ 1 2 840 113554 1 2 2 }'