mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Check to see if the command is available before running command tests.
This commit is contained in:
parent
35cbbde5bf
commit
768cb29afe
@ -28,6 +28,7 @@ from ipalib import api, request
|
|||||||
from ipalib import errors
|
from ipalib import errors
|
||||||
from tests.test_xmlrpc.xmlrpc_test import XMLRPC_test
|
from tests.test_xmlrpc.xmlrpc_test import XMLRPC_test
|
||||||
from ipaserver.plugins.ldap2 import ldap2
|
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
|
# See if our LDAP server is up and we can talk to it over GSSAPI
|
||||||
ccache = krbV.default_context().default_ccache().name
|
ccache = krbV.default_context().default_ccache().name
|
||||||
@ -46,8 +47,16 @@ class cmdline_test(XMLRPC_test):
|
|||||||
"""
|
"""
|
||||||
Base class for all command-line tests
|
Base class for all command-line tests
|
||||||
"""
|
"""
|
||||||
|
# some reasonable default command
|
||||||
|
command = '/bin/ls'
|
||||||
|
|
||||||
def setUp(self):
|
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()
|
super(cmdline_test, self).setUp()
|
||||||
if not server_available:
|
if not server_available:
|
||||||
raise nose.SkipTest(
|
raise nose.SkipTest(
|
||||||
|
@ -58,6 +58,7 @@ class test_ipagetkeytab(cmdline_test):
|
|||||||
"""
|
"""
|
||||||
Test `ipa-getkeytab`.
|
Test `ipa-getkeytab`.
|
||||||
"""
|
"""
|
||||||
|
command = "ipa-client/ipa-getkeytab"
|
||||||
host_fqdn = u'ipatest.%s' % api.env.domain
|
host_fqdn = u'ipatest.%s' % api.env.domain
|
||||||
service_princ = u'test/%s@%s' % (host_fqdn, api.env.realm)
|
service_princ = u'test/%s@%s' % (host_fqdn, api.env.realm)
|
||||||
subject = 'CN=%s,O=IPA' % host_fqdn
|
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.
|
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,
|
"-s", api.env.host,
|
||||||
"-p", "test/notfound.example.com",
|
"-p", "test/notfound.example.com",
|
||||||
"-k", self.keytabname,
|
"-k", self.keytabname,
|
||||||
@ -99,7 +100,7 @@ class test_ipagetkeytab(cmdline_test):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
os.unlink(self.keytabname)
|
os.unlink(self.keytabname)
|
||||||
new_args = ["ipa-client/ipa-getkeytab",
|
new_args = [self.command,
|
||||||
"-s", api.env.host,
|
"-s", api.env.host,
|
||||||
"-p", self.service_princ,
|
"-p", self.service_princ,
|
||||||
"-k", self.keytabname,
|
"-k", self.keytabname,
|
||||||
|
Loading…
Reference in New Issue
Block a user