From 768cb29afe892e5dfc115430f60f623220c78740 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Thu, 29 Jul 2010 10:51:47 -0400 Subject: Check to see if the command is available before running command tests. --- tests/test_cmdline/cmdline.py | 9 +++++++++ tests/test_cmdline/test_ipagetkeytab.py | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/test_cmdline/cmdline.py b/tests/test_cmdline/cmdline.py index 4de06850c..913760e3a 100644 --- a/tests/test_cmdline/cmdline.py +++ b/tests/test_cmdline/cmdline.py @@ -28,6 +28,7 @@ from ipalib import api, request from ipalib import errors from tests.test_xmlrpc.xmlrpc_test import XMLRPC_test from ipaserver.plugins.ldap2 import ldap2 +from ipapython import ipautil # See if our LDAP server is up and we can talk to it over GSSAPI ccache = krbV.default_context().default_ccache().name @@ -46,8 +47,16 @@ class cmdline_test(XMLRPC_test): """ Base class for all command-line tests """ + # some reasonable default command + command = '/bin/ls' def setUp(self): + # raise an error if the command is missing even if the remote + # server is not available. + if not ipautil.file_exists(self.command): + raise AssertionError( + 'Command %r not available' % self.command + ) super(cmdline_test, self).setUp() if not server_available: raise nose.SkipTest( diff --git a/tests/test_cmdline/test_ipagetkeytab.py b/tests/test_cmdline/test_ipagetkeytab.py index 2c51102e9..421017415 100644 --- a/tests/test_cmdline/test_ipagetkeytab.py +++ b/tests/test_cmdline/test_ipagetkeytab.py @@ -58,6 +58,7 @@ class test_ipagetkeytab(cmdline_test): """ Test `ipa-getkeytab`. """ + command = "ipa-client/ipa-getkeytab" host_fqdn = u'ipatest.%s' % api.env.domain service_princ = u'test/%s@%s' % (host_fqdn, api.env.realm) subject = 'CN=%s,O=IPA' % host_fqdn @@ -79,7 +80,7 @@ class test_ipagetkeytab(cmdline_test): """ Create a keytab with `ipa-getkeytab` for a non-existent service. """ - new_args = ["ipa-client/ipa-getkeytab", + new_args = [self.command, "-s", api.env.host, "-p", "test/notfound.example.com", "-k", self.keytabname, @@ -99,7 +100,7 @@ class test_ipagetkeytab(cmdline_test): pass os.unlink(self.keytabname) - new_args = ["ipa-client/ipa-getkeytab", + new_args = [self.command, "-s", api.env.host, "-p", self.service_princ, "-k", self.keytabname, -- cgit