summaryrefslogtreecommitdiffstats
path: root/ipatests
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2014-10-07 12:48:22 +0200
committerTomas Babej <tbabej@redhat.com>2014-11-21 12:14:44 +0100
commit375e9f7c4b855ee8abbab6b5574d54bbd9fb1742 (patch)
tree88cf59d1736cc9fb3bf23c6a8c63f4c498ebf06a /ipatests
parent7de424f42541e73ed24a95f1dd90ff4a61e111fa (diff)
downloadfreeipa-375e9f7c4b855ee8abbab6b5574d54bbd9fb1742.tar.gz
freeipa-375e9f7c4b855ee8abbab6b5574d54bbd9fb1742.tar.xz
freeipa-375e9f7c4b855ee8abbab6b5574d54bbd9fb1742.zip
tests: Use PEP8-compliant setup/teardown method names
The setUp/dearDown names are used in the unittest module, but there is no reason to use them in non-`unittest` test cases. Nose supports both styles (but mixing them can cause trouble when calling super()'s methods). Pytest only supports the new ones. https://fedorahosted.org/freeipa/ticket/4610 Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'ipatests')
-rw-r--r--ipatests/test_cmdline/cmdline.py8
-rw-r--r--ipatests/test_integration/test_caless.py6
-rw-r--r--ipatests/test_integration/test_forced_client_reenrollment.py4
-rw-r--r--ipatests/test_ipalib/test_rpc.py4
-rw-r--r--ipatests/test_ipalib/test_text.py4
-rw-r--r--ipatests/test_ipapython/test_ipavalidate.py6
-rw-r--r--ipatests/test_ipapython/test_keyring.py2
-rw-r--r--ipatests/test_ipaserver/test_changepw.py8
-rw-r--r--ipatests/test_ipaserver/test_ldap.py8
-rw-r--r--ipatests/test_pkcs10/test_pkcs10.py2
-rw-r--r--ipatests/test_webui/ui_driver.py6
-rw-r--r--ipatests/test_xmlrpc/test_cert_plugin.py16
-rw-r--r--ipatests/test_xmlrpc/test_dns_plugin.py8
-rw-r--r--ipatests/test_xmlrpc/test_external_members.py4
-rw-r--r--ipatests/test_xmlrpc/test_host_plugin.py2
-rw-r--r--ipatests/test_xmlrpc/test_permission_plugin.py4
-rw-r--r--ipatests/test_xmlrpc/test_range_plugin.py8
-rw-r--r--ipatests/test_xmlrpc/test_trust_plugin.py4
-rw-r--r--ipatests/test_xmlrpc/test_user_plugin.py4
-rw-r--r--ipatests/test_xmlrpc/xmlrpc_test.py6
-rw-r--r--ipatests/util.py4
21 files changed, 56 insertions, 62 deletions
diff --git a/ipatests/test_cmdline/cmdline.py b/ipatests/test_cmdline/cmdline.py
index e790f022e..bcb71328a 100644
--- a/ipatests/test_cmdline/cmdline.py
+++ b/ipatests/test_cmdline/cmdline.py
@@ -52,7 +52,7 @@ class cmdline_test(XMLRPC_test):
# some reasonable default command
command = paths.LS
- def setUp(self):
+ def setup(self):
# Find the executable in $PATH
# This is neded because ipautil.run resets the PATH to
# a system default.
@@ -65,14 +65,14 @@ class cmdline_test(XMLRPC_test):
raise AssertionError(
'Command %r not available' % original_command
)
- super(cmdline_test, self).setUp()
+ super(cmdline_test, self).setup()
if not server_available:
raise nose.SkipTest(
'Server not available: %r' % api.env.xmlrpc_uri
)
- def tearDown(self):
+ def teardown(self):
"""
nose tear-down fixture.
"""
- super(cmdline_test, self).tearDown()
+ super(cmdline_test, self).teardown()
diff --git a/ipatests/test_integration/test_caless.py b/ipatests/test_integration/test_caless.py
index 1bd8202c8..b2af4f7fe 100644
--- a/ipatests/test_integration/test_caless.py
+++ b/ipatests/test_integration/test_caless.py
@@ -340,7 +340,7 @@ class CALessBase(IntegrationTest):
class TestServerInstall(CALessBase):
num_replicas = 0
- def tearDown(self):
+ def teardown(self):
self.uninstall_server()
# Remove CA cert in /etc/pki/nssdb, in case of failed (un)install
@@ -750,7 +750,7 @@ class TestServerInstall(CALessBase):
class TestReplicaInstall(CALessBase):
num_replicas = 1
- def setUp(self):
+ def setup(self):
# Install the master for every test
self.export_pkcs12('ca1/server')
with open(self.pem_filename, 'w') as f:
@@ -759,7 +759,7 @@ class TestReplicaInstall(CALessBase):
result = self.install_server()
assert result.returncode == 0
- def tearDown(self):
+ def teardown(self):
# Uninstall both master and replica
replica = self.replicas[0]
tasks.kinit_admin(self.master)
diff --git a/ipatests/test_integration/test_forced_client_reenrollment.py b/ipatests/test_integration/test_forced_client_reenrollment.py
index b11652187..826e70d24 100644
--- a/ipatests/test_integration/test_forced_client_reenrollment.py
+++ b/ipatests/test_integration/test_forced_client_reenrollment.py
@@ -44,11 +44,11 @@ class TestForcedClientReenrollment(IntegrationTest):
'krb5.keytab'
)
- def setUp(self):
+ def setup(self):
tasks.prepare_host(self.clients[0])
tasks.install_client(self.master, self.clients[0])
- def tearDown(self):
+ def teardown(self):
tasks.uninstall_client(self.clients[0])
self.delete_client_host_entry()
diff --git a/ipatests/test_ipalib/test_rpc.py b/ipatests/test_ipalib/test_rpc.py
index 64e5f5e33..74a7639c9 100644
--- a/ipatests/test_ipalib/test_rpc.py
+++ b/ipatests/test_ipalib/test_rpc.py
@@ -248,7 +248,7 @@ class test_xmlclient(PluginTester):
class test_xml_introspection(object):
@classmethod
- def setUpClass(self):
+ def setup_class(self):
try:
api.Backend.xmlclient.connect(fallback=False)
except (errors.NetworkError, IOError):
@@ -256,7 +256,7 @@ class test_xml_introspection(object):
(__name__, api.env.xmlrpc_uri))
@classmethod
- def tearDownClass(self):
+ def teardown_class(self):
request.destroy_context()
def test_list_methods(self):
diff --git a/ipatests/test_ipalib/test_text.py b/ipatests/test_ipalib/test_text.py
index 4d4ce35c8..c1140d217 100644
--- a/ipatests/test_ipalib/test_text.py
+++ b/ipatests/test_ipalib/test_text.py
@@ -46,7 +46,7 @@ def test_create_translation():
class test_TestLang(object):
- def setUp(self):
+ def setup(self):
self.tmp_dir = None
self.saved_lang = None
@@ -85,7 +85,7 @@ class test_TestLang(object):
self.po_file_iterate = po_file_iterate
- def tearDown(self):
+ def teardown(self):
if self.saved_lang is not None:
os.environ['LANG'] = self.saved_lang
diff --git a/ipatests/test_ipapython/test_ipavalidate.py b/ipatests/test_ipapython/test_ipavalidate.py
index 3393de00e..b912797dd 100644
--- a/ipatests/test_ipapython/test_ipavalidate.py
+++ b/ipatests/test_ipapython/test_ipavalidate.py
@@ -25,12 +25,6 @@ import unittest
from ipapython import ipavalidate
class TestValidate(unittest.TestCase):
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
def test_validEmail(self):
self.assertEqual(True, ipavalidate.Email("test@freeipa.org"))
self.assertEqual(True, ipavalidate.Email("", notEmpty=False))
diff --git a/ipatests/test_ipapython/test_keyring.py b/ipatests/test_ipapython/test_keyring.py
index 568fd5ee1..e92b1b465 100644
--- a/ipatests/test_ipapython/test_keyring.py
+++ b/ipatests/test_ipapython/test_keyring.py
@@ -36,7 +36,7 @@ class test_keyring(object):
Test the kernel keyring interface
"""
- def setUp(self):
+ def setup(self):
try:
kernel_keyring.del_key(TEST_KEY)
except ValueError:
diff --git a/ipatests/test_ipaserver/test_changepw.py b/ipatests/test_ipaserver/test_changepw.py
index 040c9cd36..65bf5a023 100644
--- a/ipatests/test_ipaserver/test_changepw.py
+++ b/ipatests/test_ipaserver/test_changepw.py
@@ -33,8 +33,8 @@ new_password = u'new_password'
class test_changepw(XMLRPC_test, Unauthorized_HTTP_test):
app_uri = '/ipa/session/change_password'
- def setUp(self):
- super(test_changepw, self).setUp()
+ def setup(self):
+ super(test_changepw, self).setup()
try:
api.Command['user_add'](uid=testuser, givenname=u'Test', sn=u'User')
api.Command['passwd'](testuser, password=u'old_password')
@@ -43,12 +43,12 @@ class test_changepw(XMLRPC_test, Unauthorized_HTTP_test):
'Cannot set up test user: %s' % e
)
- def tearDown(self):
+ def teardown(self):
try:
api.Command['user_del']([testuser])
except errors.NotFound:
pass
- super(test_changepw, self).tearDown()
+ super(test_changepw, self).teardown()
def _changepw(self, user, old_password, new_password):
return self.send_request(params={'user': str(user),
diff --git a/ipatests/test_ipaserver/test_ldap.py b/ipatests/test_ipaserver/test_ldap.py
index 46182dbea..8b4e50058 100644
--- a/ipatests/test_ipaserver/test_ldap.py
+++ b/ipatests/test_ipaserver/test_ldap.py
@@ -44,7 +44,7 @@ class test_ldap(object):
Test various LDAP client bind methods.
"""
- def setUp(self):
+ def setup(self):
self.conn = None
self.ldapuri = 'ldap://%s' % ipautil.format_netloc(api.env.host)
self.ccache = paths.TMP_KRB5CC % os.getuid()
@@ -52,7 +52,7 @@ class test_ldap(object):
self.dn = DN(('krbprincipalname','ldap/%s@%s' % (api.env.host, api.env.realm)),
('cn','services'),('cn','accounts'),api.env.basedn)
- def tearDown(self):
+ def teardown(self):
if self.conn and self.conn.isconnected():
self.conn.disconnect()
@@ -158,14 +158,14 @@ class test_LDAPEntry(object):
dn1 = DN(('cn', cn1[0]))
dn2 = DN(('cn', cn2[0]))
- def setUp(self):
+ def setup(self):
self.ldapuri = 'ldap://%s' % ipautil.format_netloc(api.env.host)
self.conn = ldap2(shared_instance=False, ldap_uri=self.ldapuri)
self.conn.connect()
self.entry = self.conn.make_entry(self.dn1, cn=self.cn1)
- def tearDown(self):
+ def teardown(self):
if self.conn and self.conn.isconnected():
self.conn.disconnect()
diff --git a/ipatests/test_pkcs10/test_pkcs10.py b/ipatests/test_pkcs10/test_pkcs10.py
index c56c8d474..8a45327d3 100644
--- a/ipatests/test_pkcs10/test_pkcs10.py
+++ b/ipatests/test_pkcs10/test_pkcs10.py
@@ -34,7 +34,7 @@ class test_update(object):
Test the PKCS#10 Parser.
"""
- def setUp(self):
+ def setup(self):
nss.nss_init_nodb()
if ipautil.file_exists("test0.csr"):
self.testdir="./"
diff --git a/ipatests/test_webui/ui_driver.py b/ipatests/test_webui/ui_driver.py
index bf78fcb57..e706a68e0 100644
--- a/ipatests/test_webui/ui_driver.py
+++ b/ipatests/test_webui/ui_driver.py
@@ -113,7 +113,7 @@ class UI_driver(object):
"""
@classmethod
- def setUpClass(cls):
+ def setup_class(cls):
if NO_SELENIUM:
raise nose.SkipTest('Selenium not installed')
@@ -161,7 +161,7 @@ class UI_driver(object):
if 'type' not in c:
c['type'] = DEFAULT_TYPE
- def setUp(self):
+ def setup(self):
"""
Test setup
"""
@@ -169,7 +169,7 @@ class UI_driver(object):
self.driver = self.get_driver()
self.driver.maximize_window()
- def tearDown(self):
+ def teardown(self):
"""
Test clean up
"""
diff --git a/ipatests/test_xmlrpc/test_cert_plugin.py b/ipatests/test_xmlrpc/test_cert_plugin.py
index af9994430..a19032503 100644
--- a/ipatests/test_xmlrpc/test_cert_plugin.py
+++ b/ipatests/test_xmlrpc/test_cert_plugin.py
@@ -70,8 +70,8 @@ def is_db_configured():
class test_cert(XMLRPC_test):
@classmethod
- def setUpClass(cls):
- super(test_cert, cls).setUpClass()
+ def setup_class(cls):
+ super(test_cert, cls).setup_class()
if 'cert_request' not in api.Command:
raise nose.SkipTest('cert_request not registered')
@@ -83,8 +83,8 @@ class test_cert(XMLRPC_test):
new_args = new_args + args
return ipautil.run(new_args, stdin)
- def setUp(self):
- super(test_cert, self).setUp()
+ def setup(self):
+ super(test_cert, self).setup()
self.reqdir = tempfile.mkdtemp(prefix = "tmp-")
self.reqfile = self.reqdir + "/test.csr"
self.pwname = self.reqdir + "/pwd"
@@ -99,8 +99,8 @@ class test_cert(XMLRPC_test):
self.subject = DN(('CN', self.host_fqdn), x509.subject_base())
- def tearDown(self):
- super(test_cert, self).tearDown()
+ def teardown(self):
+ super(test_cert, self).teardown()
shutil.rmtree(self.reqdir, ignore_errors=True)
def generateCSR(self, subject):
@@ -204,8 +204,8 @@ class test_cert(XMLRPC_test):
class test_cert_find(XMLRPC_test):
@classmethod
- def setUpClass(cls):
- super(test_cert_find, cls).setUpClass()
+ def setup_class(cls):
+ super(test_cert_find, cls).setup_class()
if 'cert_find' not in api.Command:
raise nose.SkipTest('cert_find not registered')
diff --git a/ipatests/test_xmlrpc/test_dns_plugin.py b/ipatests/test_xmlrpc/test_dns_plugin.py
index fb5385314..6edf691f1 100644
--- a/ipatests/test_xmlrpc/test_dns_plugin.py
+++ b/ipatests/test_xmlrpc/test_dns_plugin.py
@@ -334,8 +334,8 @@ if have_ldap2:
class test_dns(Declarative):
@classmethod
- def setUpClass(cls):
- super(test_dns, cls).setUpClass()
+ def setup_class(cls):
+ super(test_dns, cls).setup_class()
if not api.Backend.rpcclient.isconnected():
api.Backend.rpcclient.connect(fallback=False)
@@ -3726,8 +3726,8 @@ zone_root_permission_dn = DN(('cn', zone_root_permission),
class test_root_zone(Declarative):
@classmethod
- def setUpClass(cls):
- super(test_root_zone, cls).setUpClass()
+ def setup_class(cls):
+ super(test_root_zone, cls).setup_class()
if not api.Backend.rpcclient.isconnected():
api.Backend.rpcclient.connect(fallback=False)
diff --git a/ipatests/test_xmlrpc/test_external_members.py b/ipatests/test_xmlrpc/test_external_members.py
index a2128cb77..83d4d134f 100644
--- a/ipatests/test_xmlrpc/test_external_members.py
+++ b/ipatests/test_xmlrpc/test_external_members.py
@@ -43,8 +43,8 @@ def get_trusted_group_name():
class test_external_members(Declarative):
@classmethod
- def setUpClass(cls):
- super(test_external_members, cls).setUpClass()
+ def setup_class(cls):
+ super(test_external_members, cls).setup_class()
if not api.Backend.rpcclient.isconnected():
api.Backend.rpcclient.connect(fallback=False)
diff --git a/ipatests/test_xmlrpc/test_host_plugin.py b/ipatests/test_xmlrpc/test_host_plugin.py
index 67acb765f..afc1e76ed 100644
--- a/ipatests/test_xmlrpc/test_host_plugin.py
+++ b/ipatests/test_xmlrpc/test_host_plugin.py
@@ -980,7 +980,7 @@ class test_host_false_pwd_change(XMLRPC_test):
command = "ipa-client/ipa-join"
@classmethod
- def setUpClass(cls):
+ def setup_class(cls):
[cls.keytabfd,cls.keytabname] = tempfile.mkstemp()
os.close(cls.keytabfd)
diff --git a/ipatests/test_xmlrpc/test_permission_plugin.py b/ipatests/test_xmlrpc/test_permission_plugin.py
index f58fa88ca..9946378fb 100644
--- a/ipatests/test_xmlrpc/test_permission_plugin.py
+++ b/ipatests/test_xmlrpc/test_permission_plugin.py
@@ -3164,8 +3164,8 @@ class test_managed_permissions(Declarative):
]
@classmethod
- def setUpClass(cls):
- super(test_managed_permissions, cls).setUpClass()
+ def setup_class(cls):
+ super(test_managed_permissions, cls).setup_class()
if not have_ldap2:
raise nose.SkipTest('server plugin not available')
diff --git a/ipatests/test_xmlrpc/test_range_plugin.py b/ipatests/test_xmlrpc/test_range_plugin.py
index ae8450f99..08f7cfac2 100644
--- a/ipatests/test_xmlrpc/test_range_plugin.py
+++ b/ipatests/test_xmlrpc/test_range_plugin.py
@@ -385,9 +385,9 @@ group1_gid = id_shift + 900100
class test_range(Declarative):
@classmethod
- def setUpClass(cls):
- super(test_range, cls).setUpClass()
- cls.tearDownClass()
+ def setup_class(cls):
+ super(test_range, cls).setup_class()
+ cls.teardown_class()
cls.mockldap = MockLDAP()
cls.mockldap.add_entry(trust_container_dn, trust_container_add)
cls.mockldap.add_entry(smb_cont_dn, smb_cont_add)
@@ -412,7 +412,7 @@ class test_range(Declarative):
cls.mockldap.unbind()
@classmethod
- def tearDownClass(cls):
+ def teardown_class(cls):
cls.mockldap = MockLDAP()
cls.mockldap.del_entry(domain2_dn)
diff --git a/ipatests/test_xmlrpc/test_trust_plugin.py b/ipatests/test_xmlrpc/test_trust_plugin.py
index 5260b4061..94e4efc93 100644
--- a/ipatests/test_xmlrpc/test_trust_plugin.py
+++ b/ipatests/test_xmlrpc/test_trust_plugin.py
@@ -39,8 +39,8 @@ default_group_dn = DN(('cn', default_group), api.env.container_group, api.env.ba
class test_trustconfig(Declarative):
@classmethod
- def setUpClass(cls):
- super(test_trustconfig, cls).setUpClass()
+ def setup_class(cls):
+ super(test_trustconfig, cls).setup_class()
if not api.Backend.rpcclient.isconnected():
api.Backend.rpcclient.connect(fallback=False)
try:
diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py
index dfca104eb..304a6d992 100644
--- a/ipatests/test_xmlrpc/test_user_plugin.py
+++ b/ipatests/test_xmlrpc/test_user_plugin.py
@@ -1607,8 +1607,8 @@ class test_denied_bind_with_expired_principal(XMLRPC_test):
password = u'random'
@classmethod
- def setUpClass(cls):
- super(test_denied_bind_with_expired_principal, cls).setUpClass()
+ def setup_class(cls):
+ super(test_denied_bind_with_expired_principal, cls).setup_class()
cls.connection = ldap.initialize('ldap://{host}'
.format(host=api.env.host))
diff --git a/ipatests/test_xmlrpc/xmlrpc_test.py b/ipatests/test_xmlrpc/xmlrpc_test.py
index f60e30412..2030f1cb2 100644
--- a/ipatests/test_xmlrpc/xmlrpc_test.py
+++ b/ipatests/test_xmlrpc/xmlrpc_test.py
@@ -168,16 +168,16 @@ class XMLRPC_test(object):
"""
@classmethod
- def setUpClass(cls):
+ def setup_class(cls):
if not server_available:
raise nose.SkipTest('%r: Server not available: %r' %
(cls.__module__, api.env.xmlrpc_uri))
- def setUp(self):
+ def setup(self):
if not api.Backend.rpcclient.isconnected():
api.Backend.rpcclient.connect(fallback=False)
- def tearDown(self):
+ def teardown(self):
"""
nose tear-down fixture.
"""
diff --git a/ipatests/util.py b/ipatests/util.py
index 30fafdc76..9d9562c58 100644
--- a/ipatests/util.py
+++ b/ipatests/util.py
@@ -448,7 +448,7 @@ class ClassChecker(object):
'get_subcls()'
)
- def tearDown(self):
+ def teardown(self):
"""
nose tear-down fixture.
"""
@@ -533,7 +533,7 @@ class PluginTester(object):
o = api[namespace][self.plugin.__name__]
return (o, api, home)
- def tearDown(self):
+ def teardown(self):
"""
nose tear-down fixture.
"""