]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Increase use of expected_msg in GSS tests
authorRobbie Harwood <rharwood@redhat.com>
Wed, 15 Feb 2017 02:22:43 +0000 (21:22 -0500)
committerGreg Hudson <ghudson@mit.edu>
Sun, 29 Aug 2021 20:48:53 +0000 (16:48 -0400)
This prevents additional debugging output from breaking the tests, and
reduces collision with k5test.py's output().

src/tests/gssapi/t_credstore.py
src/tests/gssapi/t_gssapi.py

index 9be57bb82fd5befeb85e0e3190e3d77f6e661ff0..f666e5e20744dcb1b09563e322e884be3d37127c 100644 (file)
@@ -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:'])
 
index e22cec427fe60f5c0c2710d85578f96e7b7590a9..1740a6177a52946bd21027f7f16a5d0262070d31 100755 (executable)
@@ -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 }'