summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-02-03 15:03:17 -0500
committerRob Crittenden <rcritten@redhat.com>2009-02-04 09:03:40 -0500
commit98d4644bff67a6545cada8364c84b43e2a99fe62 (patch)
tree46ab8a3f30bd11b7ca1a8780c0c57da75330f437 /tests
parent2d7e0de5ea7a2923708006bc58dae4b35b65fe63 (diff)
downloadfreeipa-98d4644bff67a6545cada8364c84b43e2a99fe62.tar.gz
freeipa-98d4644bff67a6545cada8364c84b43e2a99fe62.tar.xz
freeipa-98d4644bff67a6545cada8364c84b43e2a99fe62.zip
Fix remaining issues with XML-RPC test cases
Tied the make-test script into the test target of the top-level Makefile Added code to xmlrpc_test.py so that it configures the API if it isn't already done which enables individual tests to be executed.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xmlrpc/test_automount_plugin.py28
-rw-r--r--tests/test_xmlrpc/test_group_plugin.py4
-rw-r--r--tests/test_xmlrpc/test_host_plugin.py4
-rw-r--r--tests/test_xmlrpc/test_hostgroup_plugin.py4
-rw-r--r--tests/test_xmlrpc/test_netgroup_plugin.py2
-rw-r--r--tests/test_xmlrpc/test_user_plugin.py4
-rw-r--r--tests/test_xmlrpc/xmlrpc_test.py13
7 files changed, 36 insertions, 23 deletions
diff --git a/tests/test_xmlrpc/test_automount_plugin.py b/tests/test_xmlrpc/test_automount_plugin.py
index fde86629..4f9b9fdc 100644
--- a/tests/test_xmlrpc/test_automount_plugin.py
+++ b/tests/test_xmlrpc/test_automount_plugin.py
@@ -24,18 +24,18 @@ Test the `ipalib/plugins/f_automount' module.
import sys
from xmlrpc_test import XMLRPC_test
from ipalib import api
-from ipalib import errors
+from ipalib import errors2
class test_Service(XMLRPC_test):
"""
Test the `f_automount` plugin.
"""
- mapname='testmap'
- keyname='testkey'
- keyname2='secondkey'
- description='description of map'
- info='ro'
+ mapname=u'testmap'
+ keyname=u'testkey'
+ keyname2=u'secondkey'
+ description=u'description of map'
+ info=u'ro'
map_kw={'automountmapname': mapname, 'description': description}
key_kw={'automountmapname': mapname, 'automountkey': keyname, 'automountinformation': info}
key_kw2={'automountmapname': mapname, 'automountkey': keyname2, 'automountinformation': info}
@@ -116,8 +116,8 @@ class test_Service(XMLRPC_test):
"""
Test the `xmlrpc.automount_modkey` method.
"""
- self.key_kw['automountinformation'] = 'rw'
- self.key_kw['description'] = 'new description'
+ self.key_kw['automountinformation'] = u'rw'
+ self.key_kw['description'] = u'new description'
res = api.Command['automount_modkey'](**self.key_kw)
assert res
assert res.get('automountkey','') == self.keyname
@@ -128,11 +128,11 @@ class test_Service(XMLRPC_test):
"""
Test the `xmlrpc.automount_modmap` method.
"""
- self.map_kw['description'] = 'new description'
+ self.map_kw['description'] = u'new description'
res = api.Command['automount_modmap'](**self.map_kw)
assert res
assert res.get('automountmapname','') == self.mapname
- assert res.get('description','') == 'new description'
+ assert res.get('description','') == u'new description'
def test_remove1key(self):
"""
@@ -182,10 +182,10 @@ class test_Indirect(XMLRPC_test):
"""
Test the `f_automount` plugin Indirect map function.
"""
- mapname='auto.home'
- keyname='/home'
- parentmap='auto.master'
- description='Home directories'
+ mapname=u'auto.home'
+ keyname=u'/home'
+ parentmap=u'auto.master'
+ description=u'Home directories'
map_kw={'automountkey': keyname, 'parentmap': parentmap, 'description': description}
def test_add_indirect(self):
diff --git a/tests/test_xmlrpc/test_group_plugin.py b/tests/test_xmlrpc/test_group_plugin.py
index 2cd6bdf1..23c9b050 100644
--- a/tests/test_xmlrpc/test_group_plugin.py
+++ b/tests/test_xmlrpc/test_group_plugin.py
@@ -78,7 +78,7 @@ class test_Group(XMLRPC_test):
Test the `xmlrpc.group_add_member` with a non-existent member
"""
kw={}
- kw['groups'] = "notfound"
+ kw['groups'] = u"notfound"
res = api.Command['group_add_member'](self.cn, **kw)
# an error isn't thrown, the list of failed members is returned
assert res != []
@@ -137,7 +137,7 @@ class test_Group(XMLRPC_test):
Test the `xmlrpc.group_remove_member` method with non-member
"""
kw={}
- kw['groups'] = "notfound"
+ kw['groups'] = u"notfound"
# an error isn't thrown, the list of failed members is returned
res = api.Command['group_remove_member'](self.cn, **kw)
assert res != []
diff --git a/tests/test_xmlrpc/test_host_plugin.py b/tests/test_xmlrpc/test_host_plugin.py
index 35fbc4d4..2529868c 100644
--- a/tests/test_xmlrpc/test_host_plugin.py
+++ b/tests/test_xmlrpc/test_host_plugin.py
@@ -24,14 +24,14 @@ Test the `ipalib/plugins/f_host` module.
import sys
from xmlrpc_test import XMLRPC_test
from ipalib import api
-from ipalib import errors
+from ipalib import errors2
class test_Host(XMLRPC_test):
"""
Test the `f_host` plugin.
"""
- cn = api.env.host.decode('UTF-8')
+ cn = u'ipatesthost.%s' % api.env.domain
description = u'Test host'
localityname = u'Undisclosed location'
kw={'cn': cn, 'description': description, 'localityname': localityname}
diff --git a/tests/test_xmlrpc/test_hostgroup_plugin.py b/tests/test_xmlrpc/test_hostgroup_plugin.py
index 54e978c8..4b0d6592 100644
--- a/tests/test_xmlrpc/test_hostgroup_plugin.py
+++ b/tests/test_xmlrpc/test_hostgroup_plugin.py
@@ -24,7 +24,7 @@ Test the `ipalib/plugins/f_hostgroup` module.
import sys
from xmlrpc_test import XMLRPC_test
from ipalib import api
-from ipalib import errors
+from ipalib import errors2
class test_Host(XMLRPC_test):
@@ -35,7 +35,7 @@ class test_Host(XMLRPC_test):
description=u'Test host group'
kw={'cn': cn, 'description': description}
- host_cn = api.env.host.decode('UTF-8')
+ host_cn = u'ipatesthost.%s' % api.env.domain
host_description = u'Test host'
host_localityname = u'Undisclosed location'
diff --git a/tests/test_xmlrpc/test_netgroup_plugin.py b/tests/test_xmlrpc/test_netgroup_plugin.py
index e3ca8ddb..33c7b419 100644
--- a/tests/test_xmlrpc/test_netgroup_plugin.py
+++ b/tests/test_xmlrpc/test_netgroup_plugin.py
@@ -45,7 +45,7 @@ class test_Netgroup(XMLRPC_test):
ng_description=u'Netgroup'
ng_kw={'cn': ng_cn, 'description': ng_description}
- host_cn = api.env.host.decode('UTF-8')
+ host_cn = u'ipatesthost.%s' % api.env.domain
host_description=u'Test host'
host_localityname=u'Undisclosed location'
host_kw={'cn': host_cn, 'description': host_description, 'localityname': host_localityname}
diff --git a/tests/test_xmlrpc/test_user_plugin.py b/tests/test_xmlrpc/test_user_plugin.py
index da2df4bc..20051140 100644
--- a/tests/test_xmlrpc/test_user_plugin.py
+++ b/tests/test_xmlrpc/test_user_plugin.py
@@ -75,8 +75,8 @@ class test_User(XMLRPC_test):
"""
Test the `xmlrpc.user_find` method with all attributes.
"""
- kw={'uid':self.uid, 'all': True}
- res = api.Command['user_find'](**kw)
+ kw={'all': True}
+ res = api.Command['user_find'](self.uid, **kw)
assert res
assert len(res) == 2
assert res[1].get('givenname','') == self.givenname
diff --git a/tests/test_xmlrpc/xmlrpc_test.py b/tests/test_xmlrpc/xmlrpc_test.py
index 1070196e..8e626600 100644
--- a/tests/test_xmlrpc/xmlrpc_test.py
+++ b/tests/test_xmlrpc/xmlrpc_test.py
@@ -26,7 +26,20 @@ import socket
import nose
from ipalib import api, request
from ipalib import errors2
+from ipalib import errors
+# Initialize the API. We do this here so that one can run the tests
+# individually instead of at the top-level. If API.bootstrap()
+# has already been called we continue gracefully. Other errors will be
+# raised.
+try:
+ api.bootstrap(context='cli')
+ api.finalize()
+except StandardError, e:
+ if str(e) == "API.bootstrap() already called":
+ pass
+ else:
+ raise e
class XMLRPC_test(object):
"""