mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
fix class teardown in user plugin tests
https://fedorahosted.org/freeipa/ticket/5368 Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
committed by
Martin Basti
parent
6a401fbf31
commit
af1f6721e1
@@ -1619,6 +1619,11 @@ class test_denied_bind_with_expired_principal(XMLRPC_test):
|
||||
cls.connection = ldap.initialize('ldap://{host}'
|
||||
.format(host=api.env.host))
|
||||
|
||||
@classmethod
|
||||
def teardown_class(cls):
|
||||
cls.failsafe_del(api.Object.user, user1)
|
||||
super(test_denied_bind_with_expired_principal, cls).teardown_class()
|
||||
|
||||
def test_1_bind_as_test_user(self):
|
||||
self.failsafe_add(
|
||||
api.Object.user,
|
||||
|
||||
@@ -195,11 +195,20 @@ class XMLRPC_test(object):
|
||||
:param pk: The primary key of the entry to be created
|
||||
:param options: Kwargs to be passed to obj.add()
|
||||
"""
|
||||
self.failsafe_del(obj, pk)
|
||||
return obj.methods['add'](pk, **options)
|
||||
|
||||
@classmethod
|
||||
def failsafe_del(cls, obj, pk):
|
||||
"""
|
||||
Delete an entry if it exists
|
||||
:param obj: An Object like api.Object.user
|
||||
:param pk: The primary key of the entry to be deleted
|
||||
"""
|
||||
try:
|
||||
obj.methods['del'](pk)
|
||||
except errors.NotFound:
|
||||
pass
|
||||
return obj.methods['add'](pk, **options)
|
||||
|
||||
|
||||
IGNORE = """Command %r is missing attribute %r in output entry.
|
||||
|
||||
Reference in New Issue
Block a user