summaryrefslogtreecommitdiffstats
path: root/ipatests/test_xmlrpc/xmlrpc_test.py
diff options
context:
space:
mode:
authorAna Krivokapic <akrivoka@redhat.com>2013-08-20 15:34:39 +0200
committerPetr Viktorin <pviktori@redhat.com>2013-08-28 16:46:15 +0200
commitc392146101422808b8781c85f0f2720db230da28 (patch)
tree095acec64a62aefff7dc498602d05e38af31f626 /ipatests/test_xmlrpc/xmlrpc_test.py
parent023385510a1b9ce6b40e40b788044ba853463696 (diff)
downloadfreeipa.git-c392146101422808b8781c85f0f2720db230da28.tar.gz
freeipa.git-c392146101422808b8781c85f0f2720db230da28.tar.xz
freeipa.git-c392146101422808b8781c85f0f2720db230da28.zip
Fix tests which fail after ipa-adtrust-install
Some unit tests were failing after ipa-adtrust-install has been run on the IPA server, due to missing attributes ('ipantsecurityidentifier') and objectclasses ('ipantuserattrs' and 'ipantgroupattrs'). This patch detects if ipa-adtrust-install has been run, and adds missing attributes and objectclasses where appropriate. https://fedorahosted.org/freeipa/ticket/3852
Diffstat (limited to 'ipatests/test_xmlrpc/xmlrpc_test.py')
-rw-r--r--ipatests/test_xmlrpc/xmlrpc_test.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/ipatests/test_xmlrpc/xmlrpc_test.py b/ipatests/test_xmlrpc/xmlrpc_test.py
index bfe8efa4..2d12bcb3 100644
--- a/ipatests/test_xmlrpc/xmlrpc_test.py
+++ b/ipatests/test_xmlrpc/xmlrpc_test.py
@@ -21,8 +21,6 @@
Base class for all XML-RPC tests
"""
-import sys
-import socket
import nose
from ipatests.util import assert_deepequal, Fuzzy
from ipalib import api, request, errors
@@ -98,6 +96,20 @@ except IOError:
except errors.NotFound:
server_available = True
+adtrust_is_enabled = api.Command['adtrust_is_enabled']()['result']
+sidgen_was_run = api.Command['sidgen_was_run']()['result']
+
+
+def add_sid(d, check_sidgen=False):
+ if adtrust_is_enabled and (not check_sidgen or sidgen_was_run):
+ d['ipantsecurityidentifier'] = (fuzzy_user_or_group_sid,)
+ return d
+
+
+def add_oc(l, oc, check_sidgen=False):
+ if adtrust_is_enabled and (not check_sidgen or sidgen_was_run):
+ return l + [oc]
+ return l
def assert_attr_equal(entry, key, value):
@@ -311,15 +323,17 @@ class Declarative(XMLRPC_test):
assert_deepequal(expected.strerror, e.strerror)
def check_callable(self, nice, cmd, args, options, expected):
+ name = expected.__class__.__name__
output = dict()
e = None
try:
output = api.Command[cmd](*args, **options)
except StandardError, e:
- pass
+ pass
if not expected(e, output):
raise AssertionError(
- UNEXPECTED % (cmd, args, options, e.__class__.__name__, e)
+ UNEXPECTED % (cmd, name, args, options,
+ e.__class__.__name__, e)
)
def check_output(self, nice, cmd, args, options, expected, extra_check):