summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2009-01-28 23:21:17 -0700
committerRob Crittenden <rcritten@redhat.com>2009-02-03 15:29:05 -0500
commit0211c76cd0ce614b9c7510315dbadf5336667410 (patch)
tree0dca19c3305db51bbd9eb6503e0ef2f3f4488ffb /tests
parent5717c9d6689f15c46801f2d251e174fad4ce4748 (diff)
downloadfreeipa-0211c76cd0ce614b9c7510315dbadf5336667410.tar.gz
freeipa-0211c76cd0ce614b9c7510315dbadf5336667410.tar.xz
freeipa-0211c76cd0ce614b9c7510315dbadf5336667410.zip
Fixed some of the test_xmlrpc unit tests
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xmlrpc/test_group_plugin.py10
-rw-r--r--tests/test_xmlrpc/test_host_plugin.py16
-rw-r--r--tests/test_xmlrpc/test_hostgroup_plugin.py14
-rw-r--r--tests/test_xmlrpc/test_netgroup_plugin.py38
-rw-r--r--tests/test_xmlrpc/test_service_plugin.py10
-rw-r--r--tests/test_xmlrpc/test_user_plugin.py16
6 files changed, 52 insertions, 52 deletions
diff --git a/tests/test_xmlrpc/test_group_plugin.py b/tests/test_xmlrpc/test_group_plugin.py
index 127c0b2bf..2cd6bdf13 100644
--- a/tests/test_xmlrpc/test_group_plugin.py
+++ b/tests/test_xmlrpc/test_group_plugin.py
@@ -24,16 +24,16 @@ Test the `ipalib/plugins/f_group` module.
import sys
from xmlrpc_test import XMLRPC_test
from ipalib import api
-from ipalib import errors
+from ipalib import errors2
class test_Group(XMLRPC_test):
"""
Test the `f_group` plugin.
"""
- cn='testgroup'
- cn2='testgroup2'
- description='This is a test'
+ cn = u'testgroup'
+ cn2 = u'testgroup2'
+ description = u'This is a test'
kw={'description':description,'cn':cn}
def test_add(self):
@@ -109,7 +109,7 @@ class test_Group(XMLRPC_test):
"""
modkw = self.kw
modkw['cn'] = self.cn
- modkw['description'] = 'New description'
+ modkw['description'] = u'New description'
res = api.Command['group_mod'](**modkw)
assert res
assert res.get('description','') == 'New description'
diff --git a/tests/test_xmlrpc/test_host_plugin.py b/tests/test_xmlrpc/test_host_plugin.py
index a3921ce16..35fbc4d4d 100644
--- a/tests/test_xmlrpc/test_host_plugin.py
+++ b/tests/test_xmlrpc/test_host_plugin.py
@@ -31,9 +31,9 @@ class test_Host(XMLRPC_test):
"""
Test the `f_host` plugin.
"""
- cn='ipaexample.%s' % api.env.domain
- description='Test host'
- localityname='Undisclosed location'
+ cn = api.env.host.decode('UTF-8')
+ description = u'Test host'
+ localityname = u'Undisclosed location'
kw={'cn': cn, 'description': description, 'localityname': localityname}
def test_add(self):
@@ -41,10 +41,10 @@ class test_Host(XMLRPC_test):
Test the `xmlrpc.host_add` method.
"""
res = api.Command['host_add'](**self.kw)
- assert res
- assert res.get('description','') == self.description
- assert res.get('cn','') == self.cn
- assert res.get('l','') == self.localityname
+ assert type(res) is dict
+ assert res['description'] == self.description
+ assert res['cn'] == self.cn
+ assert res['l'] == self.localityname
def test_doshow_all(self):
"""
@@ -95,7 +95,7 @@ class test_Host(XMLRPC_test):
"""
Test the `xmlrpc.host_mod` method.
"""
- newdesc='Updated host'
+ newdesc = u'Updated host'
modkw={'cn': self.cn, 'description': newdesc}
res = api.Command['host_mod'](**modkw)
assert res
diff --git a/tests/test_xmlrpc/test_hostgroup_plugin.py b/tests/test_xmlrpc/test_hostgroup_plugin.py
index ba6c255e0..54e978c8e 100644
--- a/tests/test_xmlrpc/test_hostgroup_plugin.py
+++ b/tests/test_xmlrpc/test_hostgroup_plugin.py
@@ -31,13 +31,13 @@ class test_Host(XMLRPC_test):
"""
Test the `f_hostgroup` plugin.
"""
- cn='testgroup'
- description='Test host group'
+ cn=u'testgroup'
+ description=u'Test host group'
kw={'cn': cn, 'description': description}
- host_cn='ipaexample.%s' % api.env.domain
- host_description='Test host'
- host_localityname='Undisclosed location'
+ host_cn = api.env.host.decode('UTF-8')
+ host_description = u'Test host'
+ host_localityname = u'Undisclosed location'
def test_add(self):
"""
@@ -83,7 +83,7 @@ class test_Host(XMLRPC_test):
"""
res = api.Command['hostgroup_find'](self.cn)
assert res
- assert len(res) == 2
+ assert len(res) == 2, res
assert res[1].get('description','') == self.description
assert res[1].get('cn','') == self.cn
assert res[1].get('member','').startswith('cn=%s' % self.host_cn)
@@ -92,7 +92,7 @@ class test_Host(XMLRPC_test):
"""
Test the `xmlrpc.hostgroup_mod` method.
"""
- newdesc='Updated host group'
+ newdesc=u'Updated host group'
modkw={'cn': self.cn, 'description': newdesc}
res = api.Command['hostgroup_mod'](**modkw)
assert res
diff --git a/tests/test_xmlrpc/test_netgroup_plugin.py b/tests/test_xmlrpc/test_netgroup_plugin.py
index 231adfd90..e3ca8ddb0 100644
--- a/tests/test_xmlrpc/test_netgroup_plugin.py
+++ b/tests/test_xmlrpc/test_netgroup_plugin.py
@@ -24,7 +24,7 @@ Test the `ipalib/plugins/f_netgroup` module.
import sys
from xmlrpc_test import XMLRPC_test
from ipalib import api
-from ipalib import errors
+from ipalib import errors2
def is_member_of(members, candidate):
@@ -41,27 +41,27 @@ class test_Netgroup(XMLRPC_test):
"""
Test the `f_netgroup` plugin.
"""
- ng_cn='ng1'
- ng_description='Netgroup'
+ ng_cn=u'ng1'
+ ng_description=u'Netgroup'
ng_kw={'cn': ng_cn, 'description': ng_description}
- host_cn='ipaexample.%s' % api.env.domain
- host_description='Test host'
- host_localityname='Undisclosed location'
+ host_cn = api.env.host.decode('UTF-8')
+ host_description=u'Test host'
+ host_localityname=u'Undisclosed location'
host_kw={'cn': host_cn, 'description': host_description, 'localityname': host_localityname}
- hg_cn='ng1'
- hg_description='Netgroup'
+ hg_cn=u'ng1'
+ hg_description=u'Netgroup'
hg_kw={'cn': hg_cn, 'description': hg_description}
- user_uid='jexample'
- user_givenname='Jim'
- user_sn='Example'
- user_home='/home/%s' % user_uid
+ user_uid=u'jexample'
+ user_givenname=u'Jim'
+ user_sn=u'Example'
+ user_home=u'/home/%s' % user_uid
user_kw={'givenname':user_givenname,'sn':user_sn,'uid':user_uid,'homedirectory':user_home}
- group_cn='testgroup'
- group_description='This is a test'
+ group_cn = u'testgroup'
+ group_description = u'This is a test'
group_kw={'description':group_description,'cn':group_cn}
def test_add(self):
@@ -87,7 +87,7 @@ class test_Netgroup(XMLRPC_test):
# Add a hostgroup
res = api.Command['hostgroup_add'](**self.hg_kw)
assert res
- assert res.get('description','') == self.hg_description
+ assert res.get('description', '') == self.hg_description
assert res.get('cn','') == self.hg_cn
# Add a user
@@ -155,7 +155,7 @@ class test_Netgroup(XMLRPC_test):
Test adding external hosts
"""
kw={}
- kw['hosts'] = "nosuchhost"
+ kw['hosts'] = u"nosuchhost"
res = api.Command['netgroup_add_member'](self.ng_cn, **kw)
assert res == tuple()
res = api.Command['netgroup_show'](self.ng_cn)
@@ -179,9 +179,9 @@ class test_Netgroup(XMLRPC_test):
"""
Test the `xmlrpc.hostgroup_find` method.
"""
- res = api.Command['netgroup_find'](self.ng_cn)
+ res = api.Command.netgroup_find(self.ng_cn)
assert res
- assert len(res) == 2
+ assert len(res) == 2, repr(res)
assert res[1].get('description','') == self.ng_description
assert res[1].get('cn','') == self.ng_cn
@@ -189,7 +189,7 @@ class test_Netgroup(XMLRPC_test):
"""
Test the `xmlrpc.hostgroup_mod` method.
"""
- newdesc='Updated host group'
+ newdesc=u'Updated host group'
modkw={'cn': self.ng_cn, 'description': newdesc}
res = api.Command['netgroup_mod'](**modkw)
assert res
diff --git a/tests/test_xmlrpc/test_service_plugin.py b/tests/test_xmlrpc/test_service_plugin.py
index 1390d34ea..2a3c90ba9 100644
--- a/tests/test_xmlrpc/test_service_plugin.py
+++ b/tests/test_xmlrpc/test_service_plugin.py
@@ -24,15 +24,15 @@ Test the `ipalib/plugins/f_service` 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_service` plugin.
"""
- principal='HTTP/ipatest.%s@%s' % (api.env.domain, api.env.realm)
- hostprincipal='host/ipatest.%s@%s' % (api.env.domain, api.env.realm)
+ principal=u'HTTP/ipatest.%s@%s' % (api.env.domain, api.env.realm)
+ hostprincipal=u'host/ipatest.%s@%s' % (api.env.domain, api.env.realm)
kw={'principal':principal}
def test_add(self):
@@ -60,7 +60,7 @@ class test_Service(XMLRPC_test):
"""
Test adding a malformed principal ('foo').
"""
- kw={'principal':'foo'}
+ kw={'principal': u'foo'}
try:
res = api.Command['service_add'](**kw)
except errors2.MalformedServicePrincipal:
@@ -72,7 +72,7 @@ class test_Service(XMLRPC_test):
"""
Test adding a malformed principal ('HTTP/foo@FOO.NET').
"""
- kw={'principal':'HTTP/foo@FOO.NET'}
+ kw={'principal': u'HTTP/foo@FOO.NET'}
try:
res = api.Command['service_add'](**kw)
except errors2.RealmMismatch:
diff --git a/tests/test_xmlrpc/test_user_plugin.py b/tests/test_xmlrpc/test_user_plugin.py
index ec21f4aaf..da2df4bc8 100644
--- a/tests/test_xmlrpc/test_user_plugin.py
+++ b/tests/test_xmlrpc/test_user_plugin.py
@@ -24,18 +24,18 @@ Test the `ipalib/plugins/f_user` module.
import sys
from xmlrpc_test import XMLRPC_test
from ipalib import api
-from ipalib import errors
+from ipalib import errors2
class test_User(XMLRPC_test):
"""
Test the `f_user` plugin.
"""
- uid='jexample'
- givenname='Jim'
- sn='Example'
- home='/home/%s' % uid
- principalname='%s@%s' % (uid, api.env.realm)
+ uid=u'jexample'
+ givenname=u'Jim'
+ sn=u'Example'
+ home=u'/home/%s' % uid
+ principalname=u'%s@%s' % (uid, api.env.realm)
kw={'givenname':givenname,'sn':sn,'uid':uid,'homedirectory':home}
def test_add(self):
@@ -117,7 +117,7 @@ class test_User(XMLRPC_test):
Test the `xmlrpc.user_mod` method.
"""
modkw = self.kw
- modkw['givenname'] = 'Finkle'
+ modkw['givenname'] = u'Finkle'
res = api.Command['user_mod'](**modkw)
assert res
assert res.get('givenname','') == 'Finkle'
@@ -126,7 +126,7 @@ class test_User(XMLRPC_test):
# Ok, double-check that it was changed
res = api.Command['user_show'](self.uid)
assert res
- assert res.get('givenname','') == 'Finkle'
+ assert res.get('givenname','') == u'Finkle'
assert res.get('sn','') == self.sn
assert res.get('uid','') == self.uid