diff options
author | Tomas Babej <tbabej@redhat.com> | 2014-05-29 14:47:17 +0200 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2014-06-16 19:48:20 +0200 |
commit | 4d2ef43f287aa96df3d65b97977fc7a824b6b33c (patch) | |
tree | 4adba8f39e1f874c89a73993d6a6455b649b7bb9 /ipatests | |
parent | c7edd7b68c98d105f02a5977a0ff7c2a3081f2c9 (diff) | |
download | freeipa-4d2ef43f287aa96df3d65b97977fc7a824b6b33c.tar.gz freeipa-4d2ef43f287aa96df3d65b97977fc7a824b6b33c.tar.xz freeipa-4d2ef43f287aa96df3d65b97977fc7a824b6b33c.zip |
ipaplatform: Move all filesystem paths to ipaplatform.paths module
https://fedorahosted.org/freeipa/ticket/4052
Reviewed-By: Petr Viktorin <pviktori@redhat.com>
Diffstat (limited to 'ipatests')
-rw-r--r-- | ipatests/beakerlib_plugin.py | 5 | ||||
-rw-r--r-- | ipatests/test_cmdline/cmdline.py | 3 | ||||
-rw-r--r-- | ipatests/test_install/test_updates.py | 5 | ||||
-rw-r--r-- | ipatests/test_integration/tasks.py | 77 | ||||
-rw-r--r-- | ipatests/test_integration/test_caless.py | 29 | ||||
-rw-r--r-- | ipatests/test_integration/test_forced_client_reenrollment.py | 7 | ||||
-rw-r--r-- | ipatests/test_integration/test_legacy_clients.py | 5 | ||||
-rw-r--r-- | ipatests/test_ipalib/test_config.py | 9 | ||||
-rw-r--r-- | ipatests/test_ipalib/test_errors.py | 5 | ||||
-rw-r--r-- | ipatests/test_ipalib/test_plugable.py | 7 | ||||
-rw-r--r-- | ipatests/test_ipaserver/test_ldap.py | 3 | ||||
-rw-r--r-- | ipatests/test_webui/ui_driver.py | 3 | ||||
-rw-r--r-- | ipatests/test_xmlrpc/test_automount_plugin.py | 1 | ||||
-rw-r--r-- | ipatests/test_xmlrpc/test_cert_plugin.py | 5 | ||||
-rw-r--r-- | ipatests/test_xmlrpc/testcert.py | 5 |
15 files changed, 92 insertions, 77 deletions
diff --git a/ipatests/beakerlib_plugin.py b/ipatests/beakerlib_plugin.py index 71c1df537..1f7811a68 100644 --- a/ipatests/beakerlib_plugin.py +++ b/ipatests/beakerlib_plugin.py @@ -31,6 +31,7 @@ import nose from nose.plugins import Plugin from ipapython import ipautil +from ipaplatform.paths import paths from ipapython.ipa_log_manager import log_mgr LINK_RE = re.compile(r'https?://[^\s]+') @@ -63,8 +64,8 @@ class BeakerLibProcess(object): # Set up the Bash process self.bash = subprocess.Popen(['bash'], stdin=subprocess.PIPE, - stdout=open('/dev/null', 'w'), - stderr=open('/dev/null', 'w')) + stdout=open(paths.DEV_NULL, 'w'), + stderr=open(paths.DEV_NULL, 'w')) source_path = os.path.join(self.env['BEAKERLIB'], 'beakerlib.sh') self.run_beakerlib_command(['.', source_path]) diff --git a/ipatests/test_cmdline/cmdline.py b/ipatests/test_cmdline/cmdline.py index 0ef0137a6..e790f022e 100644 --- a/ipatests/test_cmdline/cmdline.py +++ b/ipatests/test_cmdline/cmdline.py @@ -28,6 +28,7 @@ import os from ipalib import api from ipalib import errors +from ipaplatform.paths import paths from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test from ipaserver.plugins.ldap2 import ldap2 @@ -49,7 +50,7 @@ class cmdline_test(XMLRPC_test): Base class for all command-line tests """ # some reasonable default command - command = '/bin/ls' + command = paths.LS def setUp(self): # Find the executable in $PATH diff --git a/ipatests/test_install/test_updates.py b/ipatests/test_install/test_updates.py index c8147f244..ce932ae00 100644 --- a/ipatests/test_install/test_updates.py +++ b/ipatests/test_install/test_updates.py @@ -30,6 +30,7 @@ from ipalib import errors from ipaserver.install.ldapupdate import LDAPUpdate, BadSyntax from ipaserver.install import installutils from ipapython import ipautil, ipaldap +from ipaplatform.paths import paths from ipapython.dn import DN """ @@ -123,7 +124,7 @@ class test_update(unittest.TestCase): for item in ('top', 'person', 'posixaccount', 'krbprincipalaux', 'inetuser'): self.assertTrue(item in objectclasses) - self.assertEqual(entry.single_value['loginshell'], '/bin/bash') + self.assertEqual(entry.single_value['loginshell'], paths.BASH) self.assertEqual(entry.single_value['sn'], 'User') self.assertEqual(entry.single_value['uid'], 'tuser') self.assertEqual(entry.single_value['cn'], 'Test User') @@ -307,7 +308,7 @@ class test_update(unittest.TestCase): for item in ('top', 'person', 'posixaccount', 'krbprincipalaux', 'inetuser'): self.assertTrue(item in objectclasses) - self.assertEqual(entry.single_value['loginshell'], '/bin/bash') + self.assertEqual(entry.single_value['loginshell'], paths.BASH) self.assertEqual(entry.single_value['sn'], 'User') self.assertEqual(entry.single_value['uid'], 'tuser') self.assertEqual(entry.single_value['cn'], 'Test User') diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py index ca5b44e4f..ccb0d8693 100644 --- a/ipatests/test_integration/tasks.py +++ b/ipatests/test_integration/tasks.py @@ -30,6 +30,7 @@ import StringIO from ldif import LDIFWriter from ipapython import ipautil +from ipaplatform.paths import paths from ipapython.dn import DN from ipapython.ipa_log_manager import log_mgr from ipatests.test_integration import util @@ -75,8 +76,8 @@ def backup_file(host, filename): def fix_etc_hosts(host): - backup_file(host, '/etc/hosts') - contents = host.get_file_contents('/etc/hosts') + backup_file(host, paths.HOSTS) + contents = host.get_file_contents(paths.HOSTS) # Remove existing mentions of the host's FQDN, short name, and IP contents = re.sub('\s%s(\s|$)' % re.escape(host.hostname), ' ', contents, flags=re.MULTILINE) @@ -87,12 +88,12 @@ def fix_etc_hosts(host): # Add the host's info again contents += '\n%s %s %s\n' % (host.ip, host.hostname, host.shortname) log.debug('Writing the following to /etc/hosts:\n%s', contents) - host.put_file_contents('/etc/hosts', contents) + host.put_file_contents(paths.HOSTS, contents) def fix_hostname(host): - backup_file(host, '/etc/hostname') - host.put_file_contents('/etc/hostname', host.hostname + '\n') + backup_file(host, paths.ETC_HOSTNAME) + host.put_file_contents(paths.ETC_HOSTNAME, host.hostname + '\n') host.run_command(['hostname', host.hostname]) backupname = os.path.join(host.config.test_dir, 'backup_hostname') @@ -100,24 +101,24 @@ def fix_hostname(host): def fix_resolv_conf(host): - backup_file(host, '/etc/resolv.conf') - lines = host.get_file_contents('/etc/resolv.conf').splitlines() + backup_file(host, paths.RESOLV_CONF) + lines = host.get_file_contents(paths.RESOLV_CONF).splitlines() lines = ['#' + l if l.startswith('nameserver') else l for l in lines] for other_host in host.domain.hosts: if other_host.role in ('master', 'replica'): lines.append('nameserver %s' % other_host.ip) contents = '\n'.join(lines) log.debug('Writing the following to /etc/resolv.conf:\n%s', contents) - host.put_file_contents('/etc/resolv.conf', contents) + host.put_file_contents(paths.RESOLV_CONF, contents) def fix_apache_semaphores(master): - systemd_available = master.transport.file_exists('/bin/systemctl') + systemd_available = master.transport.file_exists(paths.SYSTEMCTL) if systemd_available: master.run_command(['systemctl', 'stop', 'httpd'], raiseonerr=False) else: - master.run_command(['/sbin/service', 'httpd', 'stop'], raiseonerr=False) + master.run_command([paths.SBIN_SERVICE, 'httpd', 'stop'], raiseonerr=False) master.run_command('for line in `ipcs -s | grep apache | cut -d " " -f 2`; ' 'do ipcrm -s $line; done', raiseonerr=False) @@ -184,11 +185,11 @@ def enable_replication_debugging(host): def install_master(host): - host.collect_log('/var/log/ipaserver-install.log') - host.collect_log('/var/log/ipaclient-install.log') + host.collect_log(paths.IPASERVER_INSTALL_LOG) + host.collect_log(paths.IPACLIENT_INSTALL_LOG) inst = host.domain.realm.replace('.', '-') - host.collect_log('/var/log/dirsrv/slapd-%s/errors' % inst) - host.collect_log('/var/log/dirsrv/slapd-%s/access' % inst) + host.collect_log(paths.SLAPD_INSTANCE_ERROR_LOG_TEMPLATE % inst) + host.collect_log(paths.SLAPD_INSTANCE_ACCESS_LOG_TEMPLATE % inst) apply_common_fixes(host) fix_apache_semaphores(host) @@ -207,8 +208,8 @@ def install_master(host): def install_replica(master, replica, setup_ca=True): - replica.collect_log('/var/log/ipareplica-install.log') - replica.collect_log('/var/log/ipareplica-conncheck.log') + replica.collect_log(paths.IPAREPLICA_INSTALL_LOG) + replica.collect_log(paths.IPAREPLICA_CONNCHECK_LOG) apply_common_fixes(replica) fix_apache_semaphores(replica) @@ -218,7 +219,7 @@ def install_replica(master, replica, setup_ca=True): '--ip-address', replica.ip, replica.hostname]) replica_bundle = master.get_file_contents( - '/var/lib/ipa/replica-info-%s.gpg' % replica.hostname) + paths.REPLICA_INFO_TEMPLATE_GPG % replica.hostname) replica_filename = os.path.join(replica.config.test_dir, 'replica-info.gpg') replica.put_file_contents(replica_filename, replica_bundle) @@ -239,7 +240,7 @@ def install_replica(master, replica, setup_ca=True): def install_client(master, client, extra_args=()): - client.collect_log('/var/log/ipaclient-install.log') + client.collect_log(paths.IPACLIENT_INSTALL_LOG) apply_common_fixes(client) @@ -262,11 +263,11 @@ def install_adtrust(host): """ # ipa-adtrust-install appends to ipaserver-install.log - host.collect_log('/var/log/ipaserver-install.log') + host.collect_log(paths.IPASERVER_INSTALL_LOG) inst = host.domain.realm.replace('.', '-') - host.collect_log('/var/log/dirsrv/slapd-%s/errors' % inst) - host.collect_log('/var/log/dirsrv/slapd-%s/access' % inst) + host.collect_log(paths.SLAPD_INSTANCE_ERROR_LOG_TEMPLATE % inst) + host.collect_log(paths.SLAPD_INSTANCE_ACCESS_LOG_TEMPLATE % inst) kinit_admin(host) host.run_command(['ipa-adtrust-install', '-U', @@ -354,7 +355,7 @@ def establish_trust_with_ad(master, ad, extra_args=()): """ # Force KDC to reload MS-PAC info by trying to get TGT for HTTP - master.run_command(['kinit', '-kt', '/etc/httpd/conf/ipa.keytab', + master.run_command(['kinit', '-kt', paths.IPA_KEYTAB, 'HTTP/%s' % master.hostname]) master.run_command(['systemctl', 'restart', 'krb5kdc.service']) master.run_command(['kdestroy', '-A']) @@ -397,7 +398,7 @@ def configure_auth_to_local_rule(master, ad): % (ad.domain.realm, ad.domain.realm, ad.domain.name)) line2 = " auth_to_local = DEFAULT" - krb5_conf_content = master.get_file_contents('/etc/krb5.conf') + krb5_conf_content = master.get_file_contents(paths.KRB5_CONF) krb5_lines = [line.rstrip() for line in krb5_conf_content.split('\n')] realm_section_index = krb5_lines.index(section_identifier) @@ -405,7 +406,7 @@ def configure_auth_to_local_rule(master, ad): krb5_lines.insert(realm_section_index + 2, line2) krb5_conf_new_content = '\n'.join(krb5_lines) - master.put_file_contents('/etc/krb5.conf', krb5_conf_new_content) + master.put_file_contents(paths.KRB5_CONF, krb5_conf_new_content) master.run_command(['systemctl', 'restart', 'sssd']) @@ -419,13 +420,13 @@ def setup_sssd_debugging(host): # First, remove any previous occurences host.run_command(['sed', '-i', '/debug_level = 7/d', - '/etc/sssd/sssd.conf' + paths.SSSD_CONF ], raiseonerr=False) # Add the debug directive to each section host.run_command(['sed', '-i', '/\[*\]/ a\debug_level = 7', - '/etc/sssd/sssd.conf' + paths.SSSD_CONF ], raiseonerr=False) @@ -440,22 +441,22 @@ def clear_sssd_cache(host): Clears SSSD cache by removing the cache files. Restarts SSSD. """ - systemd_available = host.transport.file_exists('/bin/systemctl') + systemd_available = host.transport.file_exists(paths.SYSTEMCTL) if systemd_available: host.run_command(['systemctl', 'stop', 'sssd']) else: - host.run_command(['/sbin/service', 'sssd', 'stop']) + host.run_command([paths.SBIN_SERVICE, 'sssd', 'stop']) host.run_command("find /var/lib/sss/db -name '*.ldb' | " "xargs rm -fv") - host.run_command(['rm', '-fv', '/var/lib/sss/mc/group']) - host.run_command(['rm', '-fv', '/var/lib/sss/mc/passwd']) + host.run_command(['rm', '-fv', paths.SSSD_MC_GROUP]) + host.run_command(['rm', '-fv', paths.SSSD_MC_PASSWD]) if systemd_available: host.run_command(['systemctl', 'start', 'sssd']) else: - host.run_command(['/sbin/service', 'sssd', 'start']) + host.run_command([paths.SBIN_SERVICE, 'sssd', 'start']) # To avoid false negatives due to SSSD not responding yet time.sleep(10) @@ -487,24 +488,24 @@ def kinit_admin(host): def uninstall_master(host): - host.collect_log('/var/log/ipaserver-uninstall.log') + host.collect_log(paths.IPASERVER_UNINSTALL_LOG) host.run_command(['ipa-server-install', '--uninstall', '-U'], raiseonerr=False) host.run_command(['pkidestroy', '-s', 'CA', '-i', 'pki-tomcat'], raiseonerr=False) host.run_command(['rm', '-rf', - '/var/log/pki/pki-tomcat', - '/etc/sysconfig/pki-tomcat', - '/etc/sysconfig/pki/tomcat/pki-tomcat', - '/var/lib/pki/pki-tomcat', - '/etc/pki/pki-tomcat'], + paths.TOMCAT_TOPLEVEL_DIR, + paths.SYSCONFIG_PKI_TOMCAT, + paths.SYSCONFIG_PKI_TOMCAT_PKI_TOMCAT_DIR, + paths.VAR_LIB_PKI_TOMCAT_DIR, + paths.PKI_TOMCAT], raiseonerr=False) unapply_fixes(host) def uninstall_client(host): - host.collect_log('/var/log/ipaclient-uninstall.log') + host.collect_log(paths.IPACLIENT_UNINSTALL_LOG) host.run_command(['ipa-client-install', '--uninstall', '-U'], raiseonerr=False) diff --git a/ipatests/test_integration/test_caless.py b/ipatests/test_integration/test_caless.py index d20a8511c..d5382988b 100644 --- a/ipatests/test_integration/test_caless.py +++ b/ipatests/test_integration/test_caless.py @@ -27,6 +27,7 @@ import nose from ipalib import x509 from ipapython import ipautil +from ipaplatform.paths import paths from ipapython.dn import DN from ipatests.test_integration.base import IntegrationTest from ipatests.test_integration import tasks @@ -113,7 +114,7 @@ class CALessBase(IntegrationTest): # Remove CA cert in /etc/pki/nssdb, in case of failed (un)install for host in cls.get_all_hosts(): - cls.master.run_command(['certutil', '-d', '/etc/pki/nssdb', '-D', + cls.master.run_command(['certutil', '-d', paths.NSS_DB_DIR, '-D', '-n', 'External CA cert'], raiseonerr=False) @@ -145,11 +146,11 @@ class CALessBase(IntegrationTest): for filename in set(files_to_copy): cls.copy_cert(host, filename) - cls.collect_log(host, '/var/log/ipaserver-install.log') - cls.collect_log(host, '/var/log/ipaclient-install.log') + cls.collect_log(host, paths.IPASERVER_INSTALL_LOG) + cls.collect_log(host, paths.IPACLIENT_INSTALL_LOG) inst = host.domain.realm.replace('.', '-') - cls.collect_log(host, '/var/log/dirsrv/slapd-%s/errors' % inst) - cls.collect_log(host, '/var/log/dirsrv/slapd-%s/access' % inst) + cls.collect_log(host, paths.SLAPD_INSTANCE_ERROR_LOG_TEMPLATE % inst) + cls.collect_log(host, paths.SLAPD_INSTANCE_ACCESS_LOG_TEMPLATE % inst) args = [ 'ipa-server-install', @@ -216,11 +217,11 @@ class CALessBase(IntegrationTest): os.path.join(self.cert_dir, filename), os.path.join(master.config.test_dir, filename)) - self.collect_log(replica, '/var/log/ipareplica-install.log') - self.collect_log(replica, '/var/log/ipaclient-install.log') + self.collect_log(replica, paths.IPAREPLICA_INSTALL_LOG) + self.collect_log(replica, paths.IPACLIENT_INSTALL_LOG) inst = replica.domain.realm.replace('.', '-') - self.collect_log(replica, '/var/log/dirsrv/slapd-%s/errors' % inst) - self.collect_log(replica, '/var/log/dirsrv/slapd-%s/access' % inst) + self.collect_log(replica, paths.SLAPD_INSTANCE_ERROR_LOG_TEMPLATE % inst) + self.collect_log(replica, paths.SLAPD_INSTANCE_ACCESS_LOG_TEMPLATE % inst) args = [ 'ipa-replica-prepare', @@ -244,7 +245,7 @@ class CALessBase(IntegrationTest): if result.returncode == 0: replica_bundle = master.get_file_contents( - '/var/lib/ipa/replica-info-%s.gpg' % replica.hostname) + paths.REPLICA_INFO_TEMPLATE_GPG % replica.hostname) replica.put_file_contents(self.get_replica_filename(replica), replica_bundle) else: @@ -327,7 +328,7 @@ class CALessBase(IntegrationTest): for host in self.get_all_hosts(): # Check the cert PEM file - remote_cacrt = host.get_file_contents('/etc/ipa/ca.crt') + remote_cacrt = host.get_file_contents(paths.IPA_CA_CRT) self.log.debug('%s:/etc/ipa/ca.crt contents:\n%s', host, remote_cacrt) binary_cacrt = base64.b64decode(x509.strip_header(remote_cacrt)) @@ -344,7 +345,7 @@ class TestServerInstall(CALessBase): # Remove CA cert in /etc/pki/nssdb, in case of failed (un)install for host in self.get_all_hosts(): - self.master.run_command(['certutil', '-d', '/etc/pki/nssdb', '-D', + self.master.run_command(['certutil', '-d', paths.NSS_DB_DIR, '-D', '-n', 'External CA cert'], raiseonerr=False) @@ -768,11 +769,11 @@ class TestReplicaInstall(CALessBase): self.master.run_command(['ipa', 'host-del', replica.hostname], raiseonerr=False) - replica.run_command(['certutil', '-d', '/etc/pki/nssdb', '-D', + replica.run_command(['certutil', '-d', paths.NSS_DB_DIR, '-D', '-n', 'External CA cert'], raiseonerr=False) self.uninstall_server() - self.master.run_command(['certutil', '-d', '/etc/pki/nssdb', '-D', + self.master.run_command(['certutil', '-d', paths.NSS_DB_DIR, '-D', '-n', 'External CA cert'], raiseonerr=False) def test_no_certs(self): diff --git a/ipatests/test_integration/test_forced_client_reenrollment.py b/ipatests/test_integration/test_forced_client_reenrollment.py index cece522f8..ded1a2397 100644 --- a/ipatests/test_integration/test_forced_client_reenrollment.py +++ b/ipatests/test_integration/test_forced_client_reenrollment.py @@ -18,11 +18,12 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import os import subprocess +from ipaplatform.paths import paths from ipatests.test_integration.base import IntegrationTest from ipatests.test_integration import tasks -CLIENT_KEYTAB = '/etc/krb5.keytab' +CLIENT_KEYTAB = paths.KRB5_KEYTAB class TestForcedClientReenrollment(IntegrationTest): @@ -274,9 +275,9 @@ class TestForcedClientReenrollment(IntegrationTest): """ Put server's ip address at the top of resolv.conf """ - contents = client.get_file_contents('/etc/resolv.conf') + contents = client.get_file_contents(paths.RESOLV_CONF) nameserver = 'nameserver %s\n' % server.ip if not contents.startswith(nameserver): contents = nameserver + contents.replace(nameserver, '') - client.put_file_contents('/etc/resolv.conf', contents) + client.put_file_contents(paths.RESOLV_CONF, contents) diff --git a/ipatests/test_integration/test_legacy_clients.py b/ipatests/test_integration/test_legacy_clients.py index b7fbd0165..513664e50 100644 --- a/ipatests/test_integration/test_legacy_clients.py +++ b/ipatests/test_integration/test_legacy_clients.py @@ -21,6 +21,7 @@ import os import re import nose +from ipaplatform.paths import paths from ipatests.test_integration import tasks @@ -40,7 +41,7 @@ class BaseTestLegacyClient(object): '/etc/openldap/cacerts', '/etc/openldap/ldap.conf', '/etc/nsswitch.conf', - '/etc/sssd/sssd.conf'] + paths.SSSD_CONF] # Actual test classes need to override these attributes to set the expected # values on the UID and GID results, since this varies with the usage of the @@ -88,7 +89,7 @@ class BaseTestLegacyClient(object): advice_path]) # Restart SSHD to load new PAM configuration - self.legacy_client.run_command(['/sbin/service', 'sshd', 'restart']) + self.legacy_client.run_command([paths.SBIN_SERVICE, 'sshd', 'restart']) def clear_sssd_caches(self): tasks.clear_sssd_cache(self.master) diff --git a/ipatests/test_ipalib/test_config.py b/ipatests/test_ipalib/test_config.py index e04dd9530..b4d71e558 100644 --- a/ipatests/test_ipalib/test_config.py +++ b/ipatests/test_ipalib/test_config.py @@ -32,6 +32,7 @@ from ipatests.util import TempDir, TempHome from ipalib.constants import TYPE_ERROR, OVERRIDE_ERROR, SET_ERROR, DEL_ERROR from ipalib.constants import NAME_REGEX, NAME_ERROR from ipalib import config, constants, base +from ipaplatform.paths import paths # Valid environment variables in (key, raw, value) tuples: @@ -448,8 +449,8 @@ class test_Env(ClassChecker): assert o.dot_ipa == home.join('.ipa') assert o.in_tree is False assert o.context == 'default' - assert o.confdir == '/etc/ipa' - assert o.conf == '/etc/ipa/default.conf' + assert o.confdir == paths.ETC_IPA + assert o.conf == paths.IPA_DEFAULT_CONF assert o.conf_default == o.conf # Test overriding values created by _bootstrap() @@ -461,11 +462,11 @@ class test_Env(ClassChecker): assert o.in_tree is False assert o.context == 'default' assert o.conf == '/my/wacky/whatever.conf' - assert o.conf_default == '/etc/ipa/default.conf' + assert o.conf_default == paths.IPA_DEFAULT_CONF (o, home) = self.bootstrap(conf_default='/my/wacky/default.conf') assert o.in_tree is False assert o.context == 'default' - assert o.conf == '/etc/ipa/default.conf' + assert o.conf == paths.IPA_DEFAULT_CONF assert o.conf_default == '/my/wacky/default.conf' # Test various overrides and types conversion diff --git a/ipatests/test_ipalib/test_errors.py b/ipatests/test_ipalib/test_errors.py index 258af3b3f..dcff72191 100644 --- a/ipatests/test_ipalib/test_errors.py +++ b/ipatests/test_ipalib/test_errors.py @@ -26,6 +26,7 @@ import inspect from ipatests.util import assert_equal, raises from ipalib import errors, text +from ipaplatform.paths import paths from ipalib.constants import TYPE_ERROR @@ -102,9 +103,9 @@ class test_SubprocessError(PrivateExceptionTester): """ Test the `ipalib.errors.SubprocessError.__init__` method. """ - inst = self.new(returncode=1, argv=('/bin/false',)) + inst = self.new(returncode=1, argv=(paths.BIN_FALSE,)) assert inst.returncode == 1 - assert inst.argv == ('/bin/false',) + assert inst.argv == (paths.BIN_FALSE,) assert str(inst) == "return code 1 from ('/bin/false',)" assert inst.message == str(inst) diff --git a/ipatests/test_ipalib/test_plugable.py b/ipatests/test_ipalib/test_plugable.py index c495e74dc..73b263a90 100644 --- a/ipatests/test_ipalib/test_plugable.py +++ b/ipatests/test_ipalib/test_plugable.py @@ -26,6 +26,7 @@ from ipatests.util import raises, no_set, no_del, read_only from ipatests.util import getitem, setitem, delitem from ipatests.util import ClassChecker, create_test_api from ipalib import plugable, errors, text +from ipaplatform.paths import paths class test_SetProxy(ClassChecker): @@ -277,10 +278,10 @@ class test_Plugin(ClassChecker): Test the `ipalib.plugable.Plugin.call` method. """ o = self.cls() - o.call('/bin/true') is None - e = raises(errors.SubprocessError, o.call, '/bin/false') + o.call(paths.BIN_TRUE) is None + e = raises(errors.SubprocessError, o.call, paths.BIN_FALSE) assert e.returncode == 1 - assert e.argv == ('/bin/false',) + assert e.argv == (paths.BIN_FALSE,) def test_Registrar(): diff --git a/ipatests/test_ipaserver/test_ldap.py b/ipatests/test_ipaserver/test_ldap.py index 7168a69b0..46182dbea 100644 --- a/ipatests/test_ipaserver/test_ldap.py +++ b/ipatests/test_ipaserver/test_ldap.py @@ -36,6 +36,7 @@ from ipalib.plugins.service import service, service_show from ipalib.plugins.host import host from ipalib import api, x509, create_api, errors from ipapython import ipautil +from ipaplatform.paths import paths from ipapython.dn import DN class test_ldap(object): @@ -46,7 +47,7 @@ class test_ldap(object): def setUp(self): self.conn = None self.ldapuri = 'ldap://%s' % ipautil.format_netloc(api.env.host) - self.ccache = '/tmp/krb5cc_%d' % os.getuid() + self.ccache = paths.TMP_KRB5CC % os.getuid() nss.nss_init_nodb() self.dn = DN(('krbprincipalname','ldap/%s@%s' % (api.env.host, api.env.realm)), ('cn','services'),('cn','accounts'),api.env.basedn) diff --git a/ipatests/test_webui/ui_driver.py b/ipatests/test_webui/ui_driver.py index 13ee972d3..3f40efd5a 100644 --- a/ipatests/test_webui/ui_driver.py +++ b/ipatests/test_webui/ui_driver.py @@ -53,6 +53,7 @@ try: except ImportError: NO_YAML = True from urllib2 import URLError +from ipaplatform.paths import paths ENV_MAP = { 'MASTER': 'ipa_server', @@ -186,7 +187,7 @@ class UI_driver(object): if browser == 'chromium': options = ChromeOptions() - options.binary_location = '/usr/bin/chromium-browser' + options.binary_location = paths.CHROMIUM_BROWSER if driver_type == 'remote': if not 'host' in self.config: diff --git a/ipatests/test_xmlrpc/test_automount_plugin.py b/ipatests/test_xmlrpc/test_automount_plugin.py index bd55c8583..759fa8dcc 100644 --- a/ipatests/test_xmlrpc/test_automount_plugin.py +++ b/ipatests/test_xmlrpc/test_automount_plugin.py @@ -32,6 +32,7 @@ from ipapython.dn import DN from nose.tools import raises, assert_raises # pylint: disable=E0611 from xmlrpc_test import XMLRPC_test, assert_attr_equal +from ipaplatform.paths import paths from ipatests.util import assert_deepequal diff --git a/ipatests/test_xmlrpc/test_cert_plugin.py b/ipatests/test_xmlrpc/test_cert_plugin.py index 508e9141a..af9994430 100644 --- a/ipatests/test_xmlrpc/test_cert_plugin.py +++ b/ipatests/test_xmlrpc/test_cert_plugin.py @@ -33,6 +33,7 @@ import tempfile from ipapython import ipautil import nose import base64 +from ipaplatform.paths import paths from ipapython.dn import DN # So we can save the cert from issuance and compare it later @@ -78,7 +79,7 @@ class test_cert(XMLRPC_test): is_db_configured() def run_certutil(self, args, stdin=None): - new_args = ["/usr/bin/certutil", "-d", self.reqdir] + new_args = [paths.CERTUTIL, "-d", self.reqdir] new_args = new_args + args return ipautil.run(new_args, stdin) @@ -105,7 +106,7 @@ class test_cert(XMLRPC_test): def generateCSR(self, subject): self.run_certutil(["-R", "-s", subject, "-o", self.reqfile, - "-z", "/etc/group", + "-z", paths.GROUP, "-f", self.pwname, "-a", ]) diff --git a/ipatests/test_xmlrpc/testcert.py b/ipatests/test_xmlrpc/testcert.py index ead6ee7f5..77179fc78 100644 --- a/ipatests/test_xmlrpc/testcert.py +++ b/ipatests/test_xmlrpc/testcert.py @@ -31,6 +31,7 @@ import shutil from ipalib import api, x509 from ipaserver.plugins import rabase from ipapython import ipautil +from ipaplatform.paths import paths from ipapython.dn import DN _testcert = None @@ -52,7 +53,7 @@ def run_certutil(reqdir, args, stdin=None): """ Run an NSS certutil command """ - new_args = ["/usr/bin/certutil", "-d", reqdir] + new_args = [paths.CERTUTIL, "-d", reqdir] new_args = new_args + args return ipautil.run(new_args, stdin) @@ -64,7 +65,7 @@ def generate_csr(reqdir, pwname, subject): req_path = os.path.join(reqdir, 'req') run_certutil(reqdir, ["-R", "-s", subject, "-o", req_path, - "-z", "/etc/group", + "-z", paths.GROUP, "-f", pwname, "-a"]) with open(req_path, "r") as fp: |