summaryrefslogtreecommitdiffstats
path: root/tests/test_xmlrpc/test_host_plugin.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2009-12-09 09:09:53 -0700
committerJason Gerard DeRose <jderose@redhat.com>2009-12-10 08:29:15 -0700
commitb6e4972e7f6aa08e0392a2cf441b60ab0e7d88b7 (patch)
tree7e5329a51af169ce34a7d275a1bbd63c1e31c026 /tests/test_xmlrpc/test_host_plugin.py
parentd08b8858ddc3bf6265f6ea8acae6661b9fff5112 (diff)
downloadfreeipa-b6e4972e7f6aa08e0392a2cf441b60ab0e7d88b7.tar.gz
freeipa-b6e4972e7f6aa08e0392a2cf441b60ab0e7d88b7.tar.xz
freeipa-b6e4972e7f6aa08e0392a2cf441b60ab0e7d88b7.zip
Take 2: Extensible return values and validation; steps toward a single output_for_cli(); enable more webUI stuff
Diffstat (limited to 'tests/test_xmlrpc/test_host_plugin.py')
-rw-r--r--tests/test_xmlrpc/test_host_plugin.py32
1 files changed, 14 insertions, 18 deletions
diff --git a/tests/test_xmlrpc/test_host_plugin.py b/tests/test_xmlrpc/test_host_plugin.py
index 817c759eb..009e98eb6 100644
--- a/tests/test_xmlrpc/test_host_plugin.py
+++ b/tests/test_xmlrpc/test_host_plugin.py
@@ -40,7 +40,7 @@ class test_host(XMLRPC_test):
"""
Test the `xmlrpc.host_add` method.
"""
- (dn, res) = api.Command['host_add'](**self.kw)
+ res = api.Command['host_add'](**self.kw)['result']
assert type(res) is dict
assert_attr_equal(res, 'description', self.description)
assert_attr_equal(res, 'fqdn', self.fqdn)
@@ -52,9 +52,7 @@ class test_host(XMLRPC_test):
Test the `xmlrpc.host_show` method with all attributes.
"""
kw = {'fqdn': self.fqdn, 'all': True, 'raw': True}
- (dn, res) = api.Command['host_show'](**kw)
- print res
- print '%r' % res
+ res = api.Command['host_show'](**kw)['result']
assert res
assert_attr_equal(res, 'description', self.description)
assert_attr_equal(res, 'fqdn', self.fqdn)
@@ -65,7 +63,7 @@ class test_host(XMLRPC_test):
Test the `xmlrpc.host_show` method with default attributes.
"""
kw = {'fqdn': self.fqdn, 'raw': True}
- (dn, res) = api.Command['host_show'](**kw)
+ res = api.Command['host_show'](**kw)['result']
assert res
assert_attr_equal(res, 'description', self.description)
assert_attr_equal(res, 'fqdn', self.fqdn)
@@ -76,21 +74,21 @@ class test_host(XMLRPC_test):
Test the `xmlrpc.host_find` method with all attributes.
"""
kw = {'fqdn': self.fqdn, 'all': True, 'raw': True}
- (res, truncated) = api.Command['host_find'](**kw)
+ res = api.Command['host_find'](**kw)['result']
assert res
- assert_attr_equal(res[0][1], 'description', self.description)
- assert_attr_equal(res[0][1], 'fqdn', self.fqdn)
- assert_attr_equal(res[0][1], 'l', self.localityname)
+ assert_attr_equal(res[0], 'description', self.description)
+ assert_attr_equal(res[0], 'fqdn', self.fqdn)
+ assert_attr_equal(res[0], 'l', self.localityname)
def test_5_host_find(self):
"""
Test the `xmlrpc.host_find` method with default attributes.
"""
- (res, truncated) = api.Command['host_find'](self.fqdn, raw=True)
+ res = api.Command['host_find'](self.fqdn, raw=True)['result']
assert res
- assert_attr_equal(res[0][1], 'description', self.description)
- assert_attr_equal(res[0][1], 'fqdn', self.fqdn)
- assert_attr_equal(res[0][1], 'localityname', self.localityname)
+ assert_attr_equal(res[0], 'description', self.description)
+ assert_attr_equal(res[0], 'fqdn', self.fqdn)
+ assert_attr_equal(res[0], 'localityname', self.localityname)
def test_6_host_mod(self):
"""
@@ -98,12 +96,12 @@ class test_host(XMLRPC_test):
"""
newdesc = u'Updated host'
modkw = {'fqdn': self.fqdn, 'description': newdesc, 'raw': True}
- (dn, res) = api.Command['host_mod'](**modkw)
+ res = api.Command['host_mod'](**modkw)['result']
assert res
assert_attr_equal(res, 'description', newdesc)
# Ok, double-check that it was changed
- (dn, res) = api.Command['host_show'](self.fqdn, raw=True)
+ res = api.Command['host_show'](self.fqdn, raw=True)['result']
assert res
assert_attr_equal(res, 'description', newdesc)
assert_attr_equal(res, 'fqdn', self.fqdn)
@@ -112,8 +110,7 @@ class test_host(XMLRPC_test):
"""
Test the `xmlrpc.host_del` method.
"""
- res = api.Command['host_del'](self.fqdn)
- assert res == True
+ assert api.Command['host_del'](self.fqdn)['result'] is True
# Verify that it is gone
try:
@@ -122,4 +119,3 @@ class test_host(XMLRPC_test):
pass
else:
assert False
-