diff options
author | Rob Crittenden <rcritten@redhat.com> | 2010-07-12 17:48:58 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2010-08-06 13:12:02 -0400 |
commit | 4ea34d5910f304c50a1a432f43318239b1db8be6 (patch) | |
tree | 3dcac52c0bb6efe19e822cc4600cdcf56e0b6d09 /tests/test_cmdline/cmdline.py | |
parent | e874b41c5b8efd3b8187bec1b301fdd64f67789c (diff) | |
download | freeipa-4ea34d5910f304c50a1a432f43318239b1db8be6.tar.gz freeipa-4ea34d5910f304c50a1a432f43318239b1db8be6.tar.xz freeipa-4ea34d5910f304c50a1a432f43318239b1db8be6.zip |
Add framework for other command-line tests, starting with ipa-getkeytab.
Diffstat (limited to 'tests/test_cmdline/cmdline.py')
-rw-r--r-- | tests/test_cmdline/cmdline.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/test_cmdline/cmdline.py b/tests/test_cmdline/cmdline.py new file mode 100644 index 000000000..4de06850c --- /dev/null +++ b/tests/test_cmdline/cmdline.py @@ -0,0 +1,61 @@ +# Authors: +# Rob Crittenden <rcritten@redhat.com> +# +# Copyright (C) 2010 Red Hat +# see file 'COPYING' for use and warranty information +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; version 2 only +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +""" +Base class for all cmdline tests +""" + +import nose +import ldap +import krbV +from ipalib import api, request +from ipalib import errors +from tests.test_xmlrpc.xmlrpc_test import XMLRPC_test +from ipaserver.plugins.ldap2 import ldap2 + +# See if our LDAP server is up and we can talk to it over GSSAPI +ccache = krbV.default_context().default_ccache().name + +try: + conn = ldap2(shared_instance=False, ldap_uri=api.env.ldap_uri, base_dn=api.env.basedn) + conn.connect(ccache=ccache) + conn.disconnect() + server_available = True +except errors.DatabaseError: + server_available = False +except Exception, e: + server_available = False + +class cmdline_test(XMLRPC_test): + """ + Base class for all command-line tests + """ + + def setUp(self): + super(cmdline_test, self).setUp() + if not server_available: + raise nose.SkipTest( + 'Server not available: %r' % api.env.xmlrpc_uri + ) + + def tearDown(self): + """ + nose tear-down fixture. + """ + super(cmdline_test, self).tearDown() |