summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xmlrpc/test_automount_plugin.py12
-rw-r--r--tests/test_xmlrpc/test_group_plugin.py10
-rw-r--r--tests/test_xmlrpc/test_host_plugin.py2
-rw-r--r--tests/test_xmlrpc/test_hostgroup_plugin.py8
-rw-r--r--tests/test_xmlrpc/test_netgroup_plugin.py30
-rw-r--r--tests/test_xmlrpc/test_service_plugin.py31
-rw-r--r--tests/test_xmlrpc/test_user_plugin.py4
-rw-r--r--tests/test_xmlrpc/xmlrpc_test.py4
8 files changed, 64 insertions, 37 deletions
diff --git a/tests/test_xmlrpc/test_automount_plugin.py b/tests/test_xmlrpc/test_automount_plugin.py
index 9de53ea1e..fde86629f 100644
--- a/tests/test_xmlrpc/test_automount_plugin.py
+++ b/tests/test_xmlrpc/test_automount_plugin.py
@@ -70,7 +70,7 @@ class test_Service(XMLRPC_test):
"""
try:
res = api.Command['automount_addkey'](**self.key_kw)
- except errors.DuplicateEntry:
+ except errors2.DuplicateEntry:
pass
else:
assert False
@@ -145,7 +145,7 @@ class test_Service(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['automount_showkey'](**delkey_kw)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
@@ -160,7 +160,7 @@ class test_Service(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['automount_showmap'](self.mapname)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
@@ -173,7 +173,7 @@ class test_Service(XMLRPC_test):
key_kw={'automountmapname': self.mapname, 'automountkey': self.keyname2}
try:
res = api.Command['automount_showkey'](**key_kw)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
@@ -216,7 +216,7 @@ class test_Indirect(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['automount_showkey'](**delkey_kw)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
@@ -231,7 +231,7 @@ class test_Indirect(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['automount_showmap'](self.mapname)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
diff --git a/tests/test_xmlrpc/test_group_plugin.py b/tests/test_xmlrpc/test_group_plugin.py
index 48cb3c97f..127c0b2bf 100644
--- a/tests/test_xmlrpc/test_group_plugin.py
+++ b/tests/test_xmlrpc/test_group_plugin.py
@@ -51,10 +51,10 @@ class test_Group(XMLRPC_test):
"""
try:
res = api.Command['group_add'](**self.kw)
- except errors.DuplicateEntry:
+ except errors2.DuplicateEntry:
pass
- def test_add2(self):
+ def test_add3(self):
"""
Test the `xmlrpc.group_add` method.
"""
@@ -71,7 +71,7 @@ class test_Group(XMLRPC_test):
kw={}
kw['groups'] = self.cn2
res = api.Command['group_add_member'](self.cn, **kw)
- assert res == []
+ assert res == tuple()
def test_add_member2(self):
"""
@@ -152,7 +152,7 @@ class test_Group(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['group_show'](self.cn)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
@@ -167,7 +167,7 @@ class test_Group(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['group_show'](self.cn2)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
diff --git a/tests/test_xmlrpc/test_host_plugin.py b/tests/test_xmlrpc/test_host_plugin.py
index f9e4108ee..a3921ce16 100644
--- a/tests/test_xmlrpc/test_host_plugin.py
+++ b/tests/test_xmlrpc/test_host_plugin.py
@@ -117,7 +117,7 @@ class test_Host(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['host_show'](self.cn)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
diff --git a/tests/test_xmlrpc/test_hostgroup_plugin.py b/tests/test_xmlrpc/test_hostgroup_plugin.py
index 1f1a5f3d1..ba6c255e0 100644
--- a/tests/test_xmlrpc/test_hostgroup_plugin.py
+++ b/tests/test_xmlrpc/test_hostgroup_plugin.py
@@ -65,7 +65,7 @@ class test_Host(XMLRPC_test):
kw={}
kw['hosts'] = self.host_cn
res = api.Command['hostgroup_add_member'](self.cn, **kw)
- assert res == []
+ assert res == tuple()
def test_doshow(self):
"""
@@ -111,7 +111,7 @@ class test_Host(XMLRPC_test):
kw={}
kw['hosts'] = self.host_cn
res = api.Command['hostgroup_remove_member'](self.cn, **kw)
- assert res == []
+ assert res == tuple()
def test_remove(self):
"""
@@ -123,7 +123,7 @@ class test_Host(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['hostgroup_show'](self.cn)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
@@ -138,7 +138,7 @@ class test_Host(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['host_show'](self.host_cn)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
diff --git a/tests/test_xmlrpc/test_netgroup_plugin.py b/tests/test_xmlrpc/test_netgroup_plugin.py
index 056ee0056..231adfd90 100644
--- a/tests/test_xmlrpc/test_netgroup_plugin.py
+++ b/tests/test_xmlrpc/test_netgroup_plugin.py
@@ -28,6 +28,8 @@ from ipalib import errors
def is_member_of(members, candidate):
+ if isinstance(members, tuple):
+ members = list(members)
if not isinstance(members, list):
members = [members]
for m in members:
@@ -107,22 +109,22 @@ class test_Netgroup(XMLRPC_test):
kw={}
kw['hosts'] = self.host_cn
res = api.Command['netgroup_add_member'](self.ng_cn, **kw)
- assert res == []
+ assert res == tuple()
kw={}
kw['hostgroups'] = self.hg_cn
res = api.Command['netgroup_add_member'](self.ng_cn, **kw)
- assert res == []
+ assert res == tuple()
kw={}
kw['users'] = self.user_uid
res = api.Command['netgroup_add_member'](self.ng_cn, **kw)
- assert res == []
+ assert res == tuple()
kw={}
kw['groups'] = self.group_cn
res = api.Command['netgroup_add_member'](self.ng_cn, **kw)
- assert res == []
+ assert res == tuple()
def test_addmembers2(self):
"""
@@ -155,7 +157,7 @@ class test_Netgroup(XMLRPC_test):
kw={}
kw['hosts'] = "nosuchhost"
res = api.Command['netgroup_add_member'](self.ng_cn, **kw)
- assert res == []
+ assert res == tuple()
res = api.Command['netgroup_show'](self.ng_cn)
assert res
assert is_member_of(res.get('externalhost',[]), kw['hosts'])
@@ -206,22 +208,22 @@ class test_Netgroup(XMLRPC_test):
kw={}
kw['hosts'] = self.host_cn
res = api.Command['netgroup_remove_member'](self.ng_cn, **kw)
- assert res == []
+ assert res == tuple()
kw={}
kw['hostgroups'] = self.hg_cn
res = api.Command['netgroup_remove_member'](self.ng_cn, **kw)
- assert res == []
+ assert res == tuple()
kw={}
kw['users'] = self.user_uid
res = api.Command['netgroup_remove_member'](self.ng_cn, **kw)
- assert res == []
+ assert res == tuple()
kw={}
kw['groups'] = self.group_cn
res = api.Command['netgroup_remove_member'](self.ng_cn, **kw)
- assert res == []
+ assert res == tuple()
def test_member_remove2(self):
"""
@@ -257,7 +259,7 @@ class test_Netgroup(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['netgroup_show'](self.ng_cn)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
@@ -273,7 +275,7 @@ class test_Netgroup(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['host_show'](self.host_cn)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
@@ -285,7 +287,7 @@ class test_Netgroup(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['hostgroup_show'](self.hg_cn)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
@@ -297,7 +299,7 @@ class test_Netgroup(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['user_show'](self.user_uid)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
@@ -309,7 +311,7 @@ class test_Netgroup(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['group_show'](self.group_cn)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
diff --git a/tests/test_xmlrpc/test_service_plugin.py b/tests/test_xmlrpc/test_service_plugin.py
index ca5d7e01e..1390d34ea 100644
--- a/tests/test_xmlrpc/test_service_plugin.py
+++ b/tests/test_xmlrpc/test_service_plugin.py
@@ -45,12 +45,37 @@ class test_Service(XMLRPC_test):
def test_add_host(self):
"""
- Test adding a host principal using `xmlrpc.service_add` method.
+ Test adding a host principal using `xmlrpc.service_add`. Host
+ services are not allowed.
"""
kw={'principal':self.hostprincipal}
try:
res = api.Command['service_add'](**kw)
- except errors.HostService:
+ except errors2.HostService:
+ pass
+ else:
+ assert False
+
+ def test_add_malformed1(self):
+ """
+ Test adding a malformed principal ('foo').
+ """
+ kw={'principal':'foo'}
+ try:
+ res = api.Command['service_add'](**kw)
+ except errors2.MalformedServicePrincipal:
+ pass
+ else:
+ assert False
+
+ def test_add_wrongrealm(self):
+ """
+ Test adding a malformed principal ('HTTP/foo@FOO.NET').
+ """
+ kw={'principal':'HTTP/foo@FOO.NET'}
+ try:
+ res = api.Command['service_add'](**kw)
+ except errors2.RealmMismatch:
pass
else:
assert False
@@ -82,7 +107,7 @@ class test_Service(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['service_show'](self.principal)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
diff --git a/tests/test_xmlrpc/test_user_plugin.py b/tests/test_xmlrpc/test_user_plugin.py
index 72b5e808b..ec21f4aaf 100644
--- a/tests/test_xmlrpc/test_user_plugin.py
+++ b/tests/test_xmlrpc/test_user_plugin.py
@@ -55,7 +55,7 @@ class test_User(XMLRPC_test):
"""
try:
res = api.Command['user_add'](**self.kw)
- except errors.DuplicateEntry:
+ except errors2.DuplicateEntry:
pass
def test_doshow(self):
@@ -140,7 +140,7 @@ class test_User(XMLRPC_test):
# Verify that it is gone
try:
res = api.Command['user_show'](self.uid)
- except errors.NotFound:
+ except errors2.NotFound:
pass
else:
assert False
diff --git a/tests/test_xmlrpc/xmlrpc_test.py b/tests/test_xmlrpc/xmlrpc_test.py
index 08f7eab89..1070196e1 100644
--- a/tests/test_xmlrpc/xmlrpc_test.py
+++ b/tests/test_xmlrpc/xmlrpc_test.py
@@ -25,7 +25,7 @@ import sys
import socket
import nose
from ipalib import api, request
-from ipalib import errors, errors2
+from ipalib import errors2
class XMLRPC_test(object):
@@ -40,7 +40,7 @@ class XMLRPC_test(object):
res = api.Command['user_show'](u'notfound')
except errors2.NetworkError:
raise nose.SkipTest()
- except errors.NotFound:
+ except errors2.NotFound:
pass
def tearDown(self):