summaryrefslogtreecommitdiffstats
path: root/ipatests
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2014-10-29 16:42:49 +0100
committerTomas Babej <tbabej@redhat.com>2014-11-21 12:14:44 +0100
commitd42c26c542cfa02c6ba3465ce529ef0cc8f37eda (patch)
treee7da3347299d368da0c220dd2a442ff34410b535 /ipatests
parent29c28786e35ee8e7fced740e62e0b5ddaa9bb381 (diff)
downloadfreeipa-d42c26c542cfa02c6ba3465ce529ef0cc8f37eda.tar.gz
freeipa-d42c26c542cfa02c6ba3465ce529ef0cc8f37eda.tar.xz
freeipa-d42c26c542cfa02c6ba3465ce529ef0cc8f37eda.zip
test_integration: Adjust tests for pytest
- Customize install() instead of setup_class() - Use pytest parametrization instead of test generators Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'ipatests')
-rw-r--r--ipatests/test_integration/test_caless.py25
-rw-r--r--ipatests/test_integration/test_legacy_clients.py37
-rw-r--r--ipatests/test_integration/test_sudo.py8
3 files changed, 30 insertions, 40 deletions
diff --git a/ipatests/test_integration/test_caless.py b/ipatests/test_integration/test_caless.py
index 19a425e15..ef76036c2 100644
--- a/ipatests/test_integration/test_caless.py
+++ b/ipatests/test_integration/test_caless.py
@@ -24,6 +24,7 @@ import base64
import glob
import contextlib
import nose
+import pytest
from ipalib import x509
from ipapython import ipautil
@@ -31,7 +32,6 @@ from ipaplatform.paths import paths
from ipapython.dn import DN
from ipatests.test_integration.base import IntegrationTest
from ipatests.test_integration import tasks
-from ipatests.pytest_plugins.ordering import ordered
_DEFAULT = object()
@@ -1143,7 +1143,6 @@ class TestClientInstall(CALessBase):
self.verify_installation()
-@ordered
class TestIPACommands(CALessBase):
@classmethod
def install(cls):
@@ -1163,25 +1162,19 @@ class TestIPACommands(CALessBase):
cls.test_hostname = 'testhost.%s' % cls.master.domain.name
cls.test_service = 'test/%s' % cls.test_hostname
- def check_ipa_command_not_available(self, command):
+ @pytest.mark.parametrize('cmd', (
+ 'cert-status',
+ 'cert-show',
+ 'cert-find',
+ 'cert-revoke',
+ 'cert-remove-hold',
+ 'cert-status'))
+ def test_cert_commands_unavailable(self, cmd):
"Verify that the given IPA subcommand is not available"
result = self.master.run_command(['ipa', command], raiseonerr=False)
assert_error(result, "ipa: ERROR: unknown command '%s'" % command)
- def test_cert_commands_unavailable(self):
- for cmd in (
- 'cert-status',
- 'cert-show',
- 'cert-find',
- 'cert-revoke',
- 'cert-remove-hold',
- 'cert-status'):
- func = lambda: self.check_ipa_command_not_available(cmd)
- func.description = 'Verify that %s command is not available' % cmd
- func.test_argument = cmd
- yield (func, )
-
def test_cert_help_unavailable(self):
"Verify that cert plugin help is not available"
result = self.master.run_command(['ipa', 'help', 'cert'],
diff --git a/ipatests/test_integration/test_legacy_clients.py b/ipatests/test_integration/test_legacy_clients.py
index 513664e50..49ad28019 100644
--- a/ipatests/test_integration/test_legacy_clients.py
+++ b/ipatests/test_integration/test_legacy_clients.py
@@ -55,26 +55,6 @@ class BaseTestLegacyClient(object):
# To allow custom validation dependent on the trust type
posix_trust = False
- @classmethod
- def setup_class(cls):
- super(BaseTestLegacyClient, cls).setup_class()
- cls.ad = cls.ad_domains[0].ads[0]
-
- cls.legacy_client = cls.host_by_role(cls.required_extra_roles[0])
-
- # Determine whether the subdomain AD is available
- try:
- child_ad = cls.host_by_role(cls.optional_extra_roles[0])
- cls.ad_subdomain = '.'.join(
- child_ad.hostname.split('.')[1:])
- except LookupError:
- cls.ad_subdomain = None
-
- tasks.apply_common_fixes(cls.legacy_client)
-
- for f in cls.backup_files:
- tasks.backup_file(cls.legacy_client, f)
-
def test_apply_advice(self):
# Obtain the advice from the server
tasks.kinit_admin(self.master)
@@ -359,6 +339,23 @@ class BaseTestLegacyClient(object):
cls.master.run_command(['ipa', 'user-disable', 'disabledipauser'])
+ cls.ad = cls.ad_domains[0].ads[0]
+
+ cls.legacy_client = cls.host_by_role(cls.required_extra_roles[0])
+
+ # Determine whether the subdomain AD is available
+ try:
+ child_ad = cls.host_by_role(cls.optional_extra_roles[0])
+ cls.ad_subdomain = '.'.join(
+ child_ad.hostname.split('.')[1:])
+ except LookupError:
+ cls.ad_subdomain = None
+
+ tasks.apply_common_fixes(cls.legacy_client)
+
+ for f in cls.backup_files:
+ tasks.backup_file(cls.legacy_client, f)
+
@classmethod
def uninstall(cls):
cls.master.run_command(['ipa', 'user-del', 'disabledipauser'],
diff --git a/ipatests/test_integration/test_sudo.py b/ipatests/test_integration/test_sudo.py
index f26a10032..38427a788 100644
--- a/ipatests/test_integration/test_sudo.py
+++ b/ipatests/test_integration/test_sudo.py
@@ -30,8 +30,8 @@ class TestSudo(IntegrationTest):
topology = 'line'
@classmethod
- def setup_class(cls):
- super(TestSudo, cls).setup_class()
+ def install(cls):
+ super(TestSudo, cls).install()
cls.client = cls.clients[0]
@@ -70,10 +70,10 @@ class TestSudo(IntegrationTest):
'localuser'])
@classmethod
- def teardown_class(cls):
+ def uninstall(cls):
cls.client.run_command(['groupdel', 'localgroup'], raiseonerr=False)
cls.client.run_command(['userdel', 'localuser'], raiseonerr=False)
- super(TestSudo, cls).teardown_class()
+ super(TestSudo, cls).uninstall()
def list_sudo_commands(self, user, raiseonerr=False, verbose=False):
clear_sssd_cache(self.client)