summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPavel Zuna <pzuna@redhat.com>2009-06-24 15:09:39 +0200
committerRob Crittenden <rcritten@redhat.com>2009-07-02 13:33:04 -0400
commit12ee586392c774f4647ab9a3d744a98359c9cf7e (patch)
tree69452fa50fdcdc33ab638b2a9af26f7c4ead2cdc /tests
parentda461998c1558b42befd0c79e12f82cceeb0d141 (diff)
downloadfreeipa-12ee586392c774f4647ab9a3d744a98359c9cf7e.tar.gz
freeipa-12ee586392c774f4647ab9a3d744a98359c9cf7e.tar.xz
freeipa-12ee586392c774f4647ab9a3d744a98359c9cf7e.zip
Remove unit tests for old plugins.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xmlrpc/test_application_plugin.py148
-rw-r--r--tests/test_xmlrpc/test_automount_plugin.py295
-rw-r--r--tests/test_xmlrpc/test_group_plugin.py231
-rw-r--r--tests/test_xmlrpc/test_host_plugin.py123
-rw-r--r--tests/test_xmlrpc/test_hostgroup_plugin.py144
-rw-r--r--tests/test_xmlrpc/test_netgroup_plugin.py317
-rw-r--r--tests/test_xmlrpc/test_rolegroup_plugin.py143
-rw-r--r--tests/test_xmlrpc/test_service_plugin.py113
-rw-r--r--tests/test_xmlrpc/test_taskgroup_plugin.py188
-rw-r--r--tests/test_xmlrpc/test_user_plugin.py146
10 files changed, 0 insertions, 1848 deletions
diff --git a/tests/test_xmlrpc/test_application_plugin.py b/tests/test_xmlrpc/test_application_plugin.py
deleted file mode 100644
index fd850e7c9..000000000
--- a/tests/test_xmlrpc/test_application_plugin.py
+++ /dev/null
@@ -1,148 +0,0 @@
-# Authors:
-# Jakub Hrozek <jhrozek@redhat.com>
-#
-# Copyright (C) 2009 Red Hat
-# see file 'COPYING' for use and warranty information
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2 only
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-"""
-Test the `ipalib/plugins/f_application` module.
-"""
-
-from xmlrpc_test import XMLRPC_test
-from ipalib import api
-
-class test_Application(XMLRPC_test):
- """
- Test the `f_application` plugin.
- """
- app_cn=u"sudo"
- app_description=u"a sudo test app"
- kw={'cn':app_cn,'description':app_description}
-
- def test_create_config(self):
- """
- Test the `xmlrpc.application_create` method - create a config application
- """
- create_kw = dict(self.kw)
- create_kw.update({'type':u'config'})
- res = api.Command['application_create'](**create_kw)
- assert res
- assert res.get('description','') == self.app_description
- assert res.get('cn','') == self.app_cn
- assert res.get('dn','').startswith("cn=%s,%s" % (self.app_cn,api.env.container_applications))
-
- def test_create_role(self):
- """
- Test the `xmlrpc.application_create` method - create a role application
- """
- create_kw = dict(self.kw)
- create_kw.update({'type':u'role'})
- res = api.Command['application_create'](**create_kw)
- assert res
- assert res.get('description','') == self.app_description
- assert res.get('cn','') == self.app_cn
- assert res.get('dn','').startswith("cn=%s,%s" % (self.app_cn,api.env.container_roles))
-
- def test_do_show_config(self):
- """
- Test the `xmlrpc.application_show` method - show a role application
- """
- showkw = {'cn':self.app_cn, 'type':u'config'}
- res = api.Command['application_show'](**showkw)
- assert res
- assert res.get('description','') == self.app_description
- assert res.get('cn','') == self.app_cn
-
- def test_do_show_role(self):
- """
- Test the `xmlrpc.application_show` method - show a role application
- """
- showkw = {'cn':self.app_cn, 'type':u'role'}
- res = api.Command['application_show'](**showkw)
- assert res
- assert res.get('description','') == self.app_description
- assert res.get('cn','') == self.app_cn
-
- def test_do_find_config(self):
- """
- Test the `xmlrpc.application_find` method - find all config applications
- """
- kw = {'type':u'config'}
- res = api.Command['application_find'](self.app_cn, **kw)
- assert res
- assert len(res) == 2
- assert res[1].get('cn') == self.app_cn
-
- def test_do_find_role(self):
- """
- Test the `xmlrpc.application_find` method - find all role applications
- """
- kw = {'type':u'role'}
- res = api.Command['application_find'](self.app_cn, **kw)
- assert res
- assert len(res) == 2
- assert res[1].get('cn') == self.app_cn
-
- def test_edit_config(self):
- """
- Test the `xmlrpc.application_edit` method - edit a config application
- """
- modkw = dict(self.kw)
- modkw['description'] = u'foobar'
- modkw['type'] = u'config'
- res = api.Command['application_edit'](**modkw)
- assert res
- assert res.get('description','') == 'foobar'
-
- def test_edit_role(self):
- """
- Test the `xmlrpc.application_edit` method - edit a role application
- """
- modkw = dict(self.kw)
- modkw['description'] = u'foobar'
- modkw['type'] = u'role'
- res = api.Command['application_edit'](**modkw)
- assert res
- assert res.get('description','') == 'foobar'
-
- def test_remove_config(self):
- """
- Test the `xmlrpc.application_delete` method - delete a config application
- """
- delkw = {'cn':self.app_cn, 'type':u'config'}
- res = api.Command['application_delete'](**delkw)
- assert res == True
-
- # try to search for the app, should really be gone
- kw = {'type':u'config'}
- res = api.Command['application_find'](self.app_cn, **kw)
- assert res
- assert len(res) == 1
-
- def test_remove_role(self):
- """
- Test the `xmlrpc.application_delete` method - delete a role application
- """
- delkw = {'cn':self.app_cn, 'type':u'role'}
- res = api.Command['application_delete'](**delkw)
- assert res == True
-
- # try to search for the app, should really be gone
- kw = {'type':u'role'}
- res = api.Command['application_find'](self.app_cn, **kw)
- assert res
- assert len(res) == 1
-
diff --git a/tests/test_xmlrpc/test_automount_plugin.py b/tests/test_xmlrpc/test_automount_plugin.py
deleted file mode 100644
index e81375211..000000000
--- a/tests/test_xmlrpc/test_automount_plugin.py
+++ /dev/null
@@ -1,295 +0,0 @@
-# Authors:
-# Rob Crittenden <rcritten@redhat.com>
-#
-# Copyright (C) 2008 Red Hat
-# see file 'COPYING' for use and warranty information
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2 only
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-"""
-Test the `ipalib/plugins/f_automount' module.
-"""
-
-import sys
-from xmlrpc_test import XMLRPC_test
-from ipalib import api
-from ipalib import errors
-
-
-class test_Service(XMLRPC_test):
- """
- Test the `f_automount` plugin.
- """
- 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}
-
- def test_add_1map(self):
- """
- Test adding a map `xmlrpc.automount_addmap` method.
- """
- res = api.Command['automount_addmap'](**self.map_kw)
- assert res
- assert res.get('automountmapname','') == self.mapname
-
- def test_add_2key(self):
- """
- Test adding a key using `xmlrpc.automount_addkey` method.
- """
- res = api.Command['automount_addkey'](**self.key_kw2)
- assert res
- assert res.get('automountkey','') == self.keyname2
-
- def test_add_3key(self):
- """
- Test adding a key using `xmlrpc.automount_addkey` method.
- """
- res = api.Command['automount_addkey'](**self.key_kw)
- assert res
- assert res.get('automountkey','') == self.keyname
-
- def test_add_4key(self):
- """
- Test adding a duplicate key using `xmlrpc.automount_addkey` method.
- """
- try:
- res = api.Command['automount_addkey'](**self.key_kw)
- except errors.DuplicateEntry:
- pass
- else:
- assert False
-
- def test_doshowmap(self):
- """
- Test the `xmlrpc.automount_showmap` method.
- """
- res = api.Command['automount_showmap'](self.mapname)
- assert res
- assert res.get('automountmapname','') == self.mapname
-
- def test_findmap(self):
- """
- Test the `xmlrpc.automount_findmap` method.
- """
- res = api.Command['automount_findmap'](self.mapname)
- assert res
- assert len(res) == 2
- assert res[1].get('automountmapname','') == self.mapname
-
- def test_doshowkey(self):
- """
- Test the `xmlrpc.automount_showkey` method.
- """
- showkey_kw={'automountmapname': self.mapname, 'automountkey': self.keyname}
- res = api.Command['automount_showkey'](**showkey_kw)
- assert res
- assert res.get('automountkey','') == self.keyname
- assert res.get('automountinformation','') == self.info
-
- def test_findkey(self):
- """
- Test the `xmlrpc.automount_findkey` method.
- """
- res = api.Command['automount_findkey'](self.keyname)
- assert res
- assert len(res) == 2
- assert res[1].get('automountkey','') == self.keyname
- assert res[1].get('automountinformation','') == self.info
-
- def test_modkey(self):
- """
- Test the `xmlrpc.automount_modkey` method.
- """
- 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
- assert res.get('automountinformation','') == 'rw'
- assert res.get('description','') == 'new description'
-
- def test_modmap(self):
- """
- Test the `xmlrpc.automount_modmap` method.
- """
- 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','') == u'new description'
-
- def test_remove1key(self):
- """
- Test the `xmlrpc.automount_delkey` method.
- """
- delkey_kw={'automountmapname': self.mapname, 'automountkey': self.keyname}
- res = api.Command['automount_delkey'](**delkey_kw)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['automount_showkey'](**delkey_kw)
- except errors.NotFound:
- pass
- else:
- assert False
-
- def test_remove2map(self):
- """
- Test the `xmlrpc.automount_delmap` method.
- """
- res = api.Command['automount_delmap'](self.mapname)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['automount_showmap'](self.mapname)
- except errors.NotFound:
- pass
- else:
- assert False
-
- def test_remove3map(self):
- """
- Test that the `xmlrpc.automount_delmap` method removes all keys
- """
- # Verify that the second key we added is gone
- key_kw={'automountmapname': self.mapname, 'automountkey': self.keyname2}
- try:
- res = api.Command['automount_showkey'](**key_kw)
- except errors.NotFound:
- pass
- else:
- assert False
-
-class test_Indirect(XMLRPC_test):
- """
- Test the `f_automount` plugin Indirect map function.
- """
- 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):
- """
- Test adding an indirect map.
- """
- res = api.Command['automount_addindirectmap'](self.mapname, **self.map_kw)
- assert res
- assert res.get('automountinformation','') == self.mapname
-
- def test_doshowkey(self):
- """
- Test the `xmlrpc.automount_showkey` method.
- """
- showkey_kw={'automountmapname': self.parentmap, 'automountkey': self.keyname}
- res = api.Command['automount_showkey'](**showkey_kw)
- assert res
- assert res.get('automountkey','') == self.keyname
-
- def test_remove_key(self):
- """
- Remove the indirect key /home
- """
- delkey_kw={'automountmapname': self.parentmap, 'automountkey': self.keyname}
- res = api.Command['automount_delkey'](**delkey_kw)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['automount_showkey'](**delkey_kw)
- except errors.NotFound:
- pass
- else:
- assert False
-
- def test_remove_map(self):
- """
- Remove the indirect map for auto.home
- """
- res = api.Command['automount_delmap'](self.mapname)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['automount_showmap'](self.mapname)
- except errors.NotFound:
- pass
- else:
- assert False
-
-class test_IndirectNoParent(XMLRPC_test):
- """
- Test the `automount` plugin Indirect map function.
- """
- mapname=u'auto.home'
- keyname=u'/home'
- parentmap=u'auto.master'
- description=u'Home directories'
- map_kw={'automountkey': keyname, 'description': description}
-
- def test_add_indirect(self):
- """
- Test adding an indirect map with default parent.
- """
- res = api.Command['automount_addindirectmap'](self.mapname, **self.map_kw)
- assert res
- assert res.get('automountinformation','') == self.mapname
-
- def test_doshowkey(self):
- """
- Test the `xmlrpc.automount_showkey` method with default parent.
- """
- showkey_kw={'automountmapname': self.parentmap, 'automountkey': self.keyname}
- res = api.Command['automount_showkey'](**showkey_kw)
- assert res
- assert res.get('automountkey','') == self.keyname
-
- def test_remove_key(self):
- """
- Remove the indirect key /home
- """
- delkey_kw={'automountmapname': self.parentmap, 'automountkey': self.keyname}
- res = api.Command['automount_delkey'](**delkey_kw)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['automount_showkey'](**delkey_kw)
- except errors.NotFound:
- pass
- else:
- assert False
-
- def test_remove_map(self):
- """
- Remove the indirect map for auto.home
- """
- res = api.Command['automount_delmap'](self.mapname)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['automount_showmap'](self.mapname)
- except errors.NotFound:
- pass
- else:
- assert False
diff --git a/tests/test_xmlrpc/test_group_plugin.py b/tests/test_xmlrpc/test_group_plugin.py
deleted file mode 100644
index a3e854799..000000000
--- a/tests/test_xmlrpc/test_group_plugin.py
+++ /dev/null
@@ -1,231 +0,0 @@
-# Authors:
-# Rob Crittenden <rcritten@redhat.com>
-#
-# Copyright (C) 2008 Red Hat
-# see file 'COPYING' for use and warranty information
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2 only
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-"""
-Test the `ipalib/plugins/f_group` module.
-"""
-
-import sys
-from xmlrpc_test import XMLRPC_test
-from ipalib import api
-from ipalib import errors
-
-
-class test_Group(XMLRPC_test):
- """
- Test the `f_group` plugin.
- """
- cn = u'testgroup'
- cn2 = u'testgroup2'
- cnposix = u'posixgroup'
- description = u'This is a test'
- kw={'description':description,'cn':cn}
-
- def test_add(self):
- """
- Test the `xmlrpc.group_add` method: testgroup.
- """
- res = api.Command['group_add'](**self.kw)
- assert res
- assert res.get('description','') == self.description
- assert res.get('cn','') == self.cn
-
- def test_add2(self):
- """
- Test the `xmlrpc.group_add` method duplicate detection.
- """
- try:
- res = api.Command['group_add'](**self.kw)
- except errors.DuplicateEntry:
- pass
-
- def test_add3(self):
- """
- Test the `xmlrpc.group_add` method: testgroup2.
- """
- self.kw['cn'] = self.cn2
- res = api.Command['group_add'](**self.kw)
- assert res
- assert res.get('description','') == self.description
- assert res.get('cn','') == self.cn2
-
- def test_addposix(self):
- """
- Test the `xmlrpc.group_add` method: posixgroup
- """
- posixkw = {}
- posixkw['cn'] = self.cnposix
- posixkw['description'] = self.description
- posixkw['posix'] = True
- res = api.Command['group_add'](**posixkw)
- assert res
- assert res.get('description','') == self.description
- assert res.get('cn','') == self.cnposix
-
- def test_add_member(self):
- """
- Test the `xmlrpc.group_add_member` method.
- """
- kw={}
- kw['groups'] = self.cn2
- res = api.Command['group_add_member'](self.cn, **kw)
- assert res == tuple()
-
- def test_add_member2(self):
- """
- Test the `xmlrpc.group_add_member` with a non-existent member
- """
- kw={}
- 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 != []
-
- def test_doshow(self):
- """
- Test the `xmlrpc.group_show` method.
- """
- res = api.Command['group_show'](self.cn)
- assert res
- assert res.get('description','') == self.description
- assert res.get('cn','') == self.cn
- assert res.get('member','').startswith('cn=%s' % self.cn2)
-
- def test_doshowposix(self):
- """
- Test the `xmlrpc.group_show` method for a posix group.
- """
- res = api.Command['group_show'](self.cnposix)
- assert res
- assert res.get('description','') == self.description
- assert res.get('cn','') == self.cnposix
- assert res.get('gidnumber',None)
-
- def test_find(self):
- """
- Test the `xmlrpc.group_find` method.
- """
- res = api.Command['group_find'](self.cn)
- assert res
- assert len(res) == 3
- assert res[1].get('description','') == self.description
- assert res[1].get('cn','') == self.cn
-
- def test_mod(self):
- """
- Test the `xmlrpc.group_mod` method.
- """
- modkw = self.kw
- modkw['cn'] = self.cn
- modkw['description'] = u'New description'
- res = api.Command['group_mod'](**modkw)
- assert res
- assert res.get('description','') == 'New description'
-
- # Ok, double-check that it was changed
- res = api.Command['group_show'](self.cn)
- assert res
- assert res.get('description','') == 'New description'
- assert res.get('cn','') == self.cn
-
- def test_mod2(self):
- """
- Test the `xmlrpc.group_mod` method, promote a posix group
- """
- modkw = self.kw
- modkw['cn'] = self.cn
- modkw['posix'] = True
- res = api.Command['group_mod'](**modkw)
- assert res
- assert res.get('description','') == 'New description'
- assert res.get('gidnumber','')
-
- # Ok, double-check that it was changed
- res = api.Command['group_show'](self.cn)
- assert res
- assert res.get('description','') == 'New description'
- assert res.get('cn','') == self.cn
- assert res.get('gidnumber','')
-
- def test_remove_member(self):
- """
- Test the `xmlrpc.group_remove_member` method.
- """
- kw={}
- kw['groups'] = self.cn2
- res = api.Command['group_remove_member'](self.cn, **kw)
-
- res = api.Command['group_show'](self.cn)
- assert res
- assert res.get('member','') == ''
-
- def test_remove_member2(self):
- """
- Test the `xmlrpc.group_remove_member` method with non-member
- """
- kw={}
- 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 != []
-
- def test_remove_x(self):
- """
- Test the `xmlrpc.group_del` method: testgroup.
- """
- res = api.Command['group_del'](self.cn)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['group_show'](self.cn)
- except errors.NotFound:
- pass
- else:
- assert False
-
- def test_remove_x2(self):
- """
- Test the `xmlrpc.group_del` method: testgroup2.
- """
- res = api.Command['group_del'](self.cn2)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['group_show'](self.cn2)
- except errors.NotFound:
- pass
- else:
- assert False
-
- def test_remove_x3(self):
- """
- Test the `xmlrpc.group_del` method: posixgroup.
- """
- res = api.Command['group_del'](self.cnposix)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['group_show'](self.cnposix)
- except errors.NotFound:
- pass
- else:
- assert False
diff --git a/tests/test_xmlrpc/test_host_plugin.py b/tests/test_xmlrpc/test_host_plugin.py
deleted file mode 100644
index 6af53834f..000000000
--- a/tests/test_xmlrpc/test_host_plugin.py
+++ /dev/null
@@ -1,123 +0,0 @@
-# Authors:
-# Rob Crittenden <rcritten@redhat.com>
-#
-# Copyright (C) 2008 Red Hat
-# see file 'COPYING' for use and warranty information
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2 only
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-"""
-Test the `ipalib/plugins/f_host` module.
-"""
-
-import sys
-from xmlrpc_test import XMLRPC_test
-from ipalib import api
-from ipalib import errors
-
-
-class test_Host(XMLRPC_test):
- """
- Test the `f_host` plugin.
- """
- fqdn = u'ipatesthost.%s' % api.env.domain
- description = u'Test host'
- localityname = u'Undisclosed location'
- kw={'fqdn': fqdn, 'description': description, 'localityname': localityname}
-
- def test_add(self):
- """
- Test the `xmlrpc.host_add` method.
- """
- res = api.Command['host_add'](**self.kw)
- assert type(res) is dict
- assert res['description'] == self.description
- assert res['fqdn'] == self.fqdn
- assert res['l'] == self.localityname
-
- def test_doshow_all(self):
- """
- Test the `xmlrpc.host_show` method with all attributes.
- """
- kw={'fqdn':self.fqdn, 'all': True}
- res = api.Command['host_show'](**kw)
- assert res
- assert res.get('description','') == self.description
- assert res.get('fqdn','') == self.fqdn
- assert res.get('l','') == self.localityname
-
- def test_doshow_minimal(self):
- """
- Test the `xmlrpc.host_show` method with default attributes.
- """
- kw={'fqdn':self.fqdn}
- res = api.Command['host_show'](**kw)
- assert res
- assert res.get('description','') == self.description
- assert res.get('fqdn','') == self.fqdn
- assert res.get('localityname','') == self.localityname
-
- def test_find_all(self):
- """
- Test the `xmlrpc.host_find` method with all attributes.
- """
- kw={'fqdn':self.fqdn, 'all': True}
- res = api.Command['host_find'](**kw)
- assert res
- assert len(res) == 2
- assert res[1].get('description','') == self.description
- assert res[1].get('fqdn','') == self.fqdn
- assert res[1].get('l','') == self.localityname
-
- def test_find_minimal(self):
- """
- Test the `xmlrpc.host_find` method with default attributes.
- """
- res = api.Command['host_find'](self.fqdn)
- assert res
- assert len(res) == 2
- assert res[1].get('description','') == self.description
- assert res[1].get('fqdn','') == self.fqdn
- assert res[1].get('localityname','') == self.localityname
-
- def test_mod(self):
- """
- Test the `xmlrpc.host_mod` method.
- """
- newdesc = u'Updated host'
- modkw={'fqdn': self.fqdn, 'description': newdesc}
- res = api.Command['host_mod'](**modkw)
- assert res
- assert res.get('description','') == newdesc
-
- # Ok, double-check that it was changed
- res = api.Command['host_show'](self.fqdn)
- assert res
- assert res.get('description','') == newdesc
- assert res.get('fqdn','') == self.fqdn
-
- def test_remove(self):
- """
- Test the `xmlrpc.host_del` method.
- """
- res = api.Command['host_del'](self.fqdn)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['host_show'](self.fqdn)
- except errors.NotFound:
- pass
- else:
- assert False
diff --git a/tests/test_xmlrpc/test_hostgroup_plugin.py b/tests/test_xmlrpc/test_hostgroup_plugin.py
deleted file mode 100644
index 23e1c6b8c..000000000
--- a/tests/test_xmlrpc/test_hostgroup_plugin.py
+++ /dev/null
@@ -1,144 +0,0 @@
-# Authors:
-# Rob Crittenden <rcritten@redhat.com>
-#
-# Copyright (C) 2008 Red Hat
-# see file 'COPYING' for use and warranty information
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2 only
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-"""
-Test the `ipalib/plugins/f_hostgroup` module.
-"""
-
-import sys
-from xmlrpc_test import XMLRPC_test
-from ipalib import api
-from ipalib import errors
-
-
-class test_Host(XMLRPC_test):
- """
- Test the `f_hostgroup` plugin.
- """
- cn=u'testgroup'
- description=u'Test host group'
- kw={'cn': cn, 'description': description}
-
- host_fqdn = u'ipatesthost.%s' % api.env.domain
- host_description = u'Test host'
- host_localityname = u'Undisclosed location'
-
- def test_add(self):
- """
- Test the `xmlrpc.hostgroup_add` method.
- """
- res = api.Command['hostgroup_add'](**self.kw)
- assert res
- assert res.get('description','') == self.description
- assert res.get('cn','') == self.cn
-
- def test_addhost(self):
- """
- Add a host to test add/remove member.
- """
- kw={'fqdn': self.host_fqdn, 'description': self.host_description, 'localityname': self.host_localityname}
- res = api.Command['host_add'](**kw)
- assert res
- assert res.get('description','') == self.host_description
- assert res.get('fqdn','') == self.host_fqdn
-
- def test_addmember(self):
- """
- Test the `xmlrpc.hostgroup_add_member` method.
- """
- kw={}
- kw['hosts'] = self.host_fqdn
- res = api.Command['hostgroup_add_member'](self.cn, **kw)
- assert res == tuple()
-
- def test_doshow(self):
- """
- Test the `xmlrpc.hostgroup_show` method.
- """
- res = api.Command['hostgroup_show'](self.cn)
- assert res
- assert res.get('description','') == self.description
- assert res.get('cn','') == self.cn
- assert res.get('member','').startswith('fqdn=%s' % self.host_fqdn)
-
- def test_find(self):
- """
- Test the `xmlrpc.hostgroup_find` method.
- """
- res = api.Command['hostgroup_find'](self.cn)
- assert res
- 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('fqdn=%s' % self.host_fqdn)
-
- def test_mod(self):
- """
- Test the `xmlrpc.hostgroup_mod` method.
- """
- newdesc=u'Updated host group'
- modkw={'cn': self.cn, 'description': newdesc}
- res = api.Command['hostgroup_mod'](**modkw)
- assert res
- assert res.get('description','') == newdesc
-
- # Ok, double-check that it was changed
- res = api.Command['hostgroup_show'](self.cn)
- assert res
- assert res.get('description','') == newdesc
- assert res.get('cn','') == self.cn
-
- def test_member_remove(self):
- """
- Test the `xmlrpc.hostgroup_remove_member` method.
- """
- kw={}
- kw['hosts'] = self.host_fqdn
- res = api.Command['hostgroup_remove_member'](self.cn, **kw)
- assert res == tuple()
-
- def test_remove(self):
- """
- Test the `xmlrpc.hostgroup_del` method.
- """
- res = api.Command['hostgroup_del'](self.cn)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['hostgroup_show'](self.cn)
- except errors.NotFound:
- pass
- else:
- assert False
-
- def test_removehost(self):
- """
- Test the `xmlrpc.host_del` method.
- """
- res = api.Command['host_del'](self.host_fqdn)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['host_show'](self.host_fqdn)
- except errors.NotFound:
- pass
- else:
- assert False
diff --git a/tests/test_xmlrpc/test_netgroup_plugin.py b/tests/test_xmlrpc/test_netgroup_plugin.py
deleted file mode 100644
index e5de2557d..000000000
--- a/tests/test_xmlrpc/test_netgroup_plugin.py
+++ /dev/null
@@ -1,317 +0,0 @@
-# Authors:
-# Rob Crittenden <rcritten@redhat.com>
-#
-# Copyright (C) 2009 Red Hat
-# see file 'COPYING' for use and warranty information
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2 only
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-"""
-Test the `ipalib/plugins/f_netgroup` module.
-"""
-
-import sys
-from xmlrpc_test import XMLRPC_test
-from ipalib import api
-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:
- if m.startswith(candidate):
- return True
- return False
-
-class test_Netgroup(XMLRPC_test):
- """
- Test the `f_netgroup` plugin.
- """
- ng_cn=u'ng1'
- ng_description=u'Netgroup'
- ng_kw={'cn': ng_cn, 'description': ng_description, 'nisdomainname': u'example.com'}
-
- host_fqdn = u'ipatesthost.%s' % api.env.domain
- host_description=u'Test host'
- host_localityname=u'Undisclosed location'
- host_kw={'fqdn': host_fqdn, 'description': host_description, 'localityname': host_localityname}
-
- hg_cn=u'ng1'
- hg_description=u'Netgroup'
- hg_kw={'cn': hg_cn, 'description': hg_description}
-
- 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 = u'testgroup'
- group_description = u'This is a test'
- group_kw={'description':group_description,'cn':group_cn}
-
- def test_add(self):
- """
- Test the `xmlrpc.netgroup_add` method.
- """
- res = api.Command['netgroup_add'](**self.ng_kw)
- assert res
- assert res.get('description','') == self.ng_description
- assert res.get('cn','') == self.ng_cn
-
- def test_adddata(self):
- """
- Add the data needed to do additional testing.
- """
-
- # Add a host
- res = api.Command['host_add'](**self.host_kw)
- assert res
- assert res.get('description','') == self.host_description
- assert res.get('fqdn','') == self.host_fqdn
-
- # Add a hostgroup
- res = api.Command['hostgroup_add'](**self.hg_kw)
- assert res
- assert res.get('description', '') == self.hg_description
- assert res.get('cn','') == self.hg_cn
-
- # Add a user
- res = api.Command['user_add'](**self.user_kw)
- assert res
- assert res.get('givenname','') == self.user_givenname
- assert res.get('uid','') == self.user_uid
-
- # Add a group
- res = api.Command['group_add'](**self.group_kw)
- assert res
- assert res.get('description','') == self.group_description
- assert res.get('cn','') == self.group_cn
-
- def test_addmembers(self):
- """
- Test the `xmlrpc.netgroup_add_member` method.
- """
- kw={}
- kw['hosts'] = self.host_fqdn
- res = api.Command['netgroup_add_member'](self.ng_cn, **kw)
- assert res == tuple()
-
- kw={}
- kw['hostgroups'] = self.hg_cn
- res = api.Command['netgroup_add_member'](self.ng_cn, **kw)
- assert res == tuple()
-
- kw={}
- kw['users'] = self.user_uid
- res = api.Command['netgroup_add_member'](self.ng_cn, **kw)
- assert res == tuple()
-
- kw={}
- kw['groups'] = self.group_cn
- res = api.Command['netgroup_add_member'](self.ng_cn, **kw)
- assert res == tuple()
-
- def test_addmembers2(self):
- """
- Test the `xmlrpc.netgroup_add_member` method again to test dupes.
- """
- kw={}
- kw['hosts'] = self.host_fqdn
- res = api.Command['netgroup_add_member'](self.ng_cn, **kw)
- assert is_member_of(res, 'fqdn=%s' % self.host_fqdn)
-
- kw={}
- kw['hostgroups'] = self.hg_cn
- res = api.Command['netgroup_add_member'](self.ng_cn, **kw)
- assert is_member_of(res, 'cn=%s' % self.hg_cn)
-
- kw={}
- kw['users'] = self.user_uid
- res = api.Command['netgroup_add_member'](self.ng_cn, **kw)
- assert is_member_of(res, 'uid=%s' % self.user_uid)
-
- kw={}
- kw['groups'] = self.group_cn
- res = api.Command['netgroup_add_member'](self.ng_cn, **kw)
- assert is_member_of(res, 'cn=%s' % self.group_cn)
-
- def test_addexternalmembers(self):
- """
- Test adding external hosts
- """
- kw={}
- 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)
- assert res
- assert is_member_of(res.get('externalhost',[]), kw['hosts'])
-
- def test_doshow(self):
- """
- Test the `xmlrpc.netgroup_show` method.
- """
- res = api.Command['netgroup_show'](self.ng_cn)
- assert res
- assert res.get('description','') == self.ng_description
- assert res.get('cn','') == self.ng_cn
- assert is_member_of(res.get('memberhost',[]), 'fqdn=%s' % self.host_fqdn)
- assert is_member_of(res.get('memberhost',[]), 'cn=%s' % self.hg_cn)
- assert is_member_of(res.get('memberuser',[]), 'uid=%s' % self.user_uid)
- assert is_member_of(res.get('memberuser',[]), 'cn=%s' % self.group_cn)
-
- def test_find(self):
- """
- Test the `xmlrpc.hostgroup_find` method.
- """
- res = api.Command.netgroup_find(self.ng_cn)
- assert res
- assert len(res) == 2, repr(res)
- assert res[1].get('description','') == self.ng_description
- assert res[1].get('cn','') == self.ng_cn
-
- def test_mod(self):
- """
- Test the `xmlrpc.hostgroup_mod` method.
- """
- newdesc=u'Updated host group'
- modkw={'cn': self.ng_cn, 'description': newdesc}
- res = api.Command['netgroup_mod'](**modkw)
- assert res
- assert res.get('description','') == newdesc
-
- # Ok, double-check that it was changed
- res = api.Command['netgroup_show'](self.ng_cn)
- assert res
- assert res.get('description','') == newdesc
- assert res.get('cn','') == self.ng_cn
-
- def test_member_remove(self):
- """
- Test the `xmlrpc.hostgroup_remove_member` method.
- """
- kw={}
- kw['hosts'] = self.host_fqdn
- res = api.Command['netgroup_remove_member'](self.ng_cn, **kw)
- assert res == tuple()
-
- kw={}
- kw['hostgroups'] = self.hg_cn
- res = api.Command['netgroup_remove_member'](self.ng_cn, **kw)
- assert res == tuple()
-
- kw={}
- kw['users'] = self.user_uid
- res = api.Command['netgroup_remove_member'](self.ng_cn, **kw)
- assert res == tuple()
-
- kw={}
- kw['groups'] = self.group_cn
- res = api.Command['netgroup_remove_member'](self.ng_cn, **kw)
- assert res == tuple()
-
- def test_member_remove2(self):
- """
- Test the `xmlrpc.netgroup_remove_member` method again to test not found.
- """
- kw={}
- kw['hosts'] = self.host_fqdn
- res = api.Command['netgroup_remove_member'](self.ng_cn, **kw)
- assert is_member_of(res, 'fqdn=%s' % self.host_fqdn)
-
- kw={}
- kw['hostgroups'] = self.hg_cn
- res = api.Command['netgroup_remove_member'](self.ng_cn, **kw)
- assert is_member_of(res, 'cn=%s' % self.hg_cn)
-
- kw={}
- kw['users'] = self.user_uid
- res = api.Command['netgroup_remove_member'](self.ng_cn, **kw)
- assert is_member_of(res, 'uid=%s' % self.user_uid)
-
- kw={}
- kw['groups'] = self.group_cn
- res = api.Command['netgroup_remove_member'](self.ng_cn, **kw)
- assert is_member_of(res, 'cn=%s' % self.group_cn)
-
- def test_remove(self):
- """
- Test the `xmlrpc.netgroup_del` method.
- """
- res = api.Command['netgroup_del'](self.ng_cn)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['netgroup_show'](self.ng_cn)
- except errors.NotFound:
- pass
- else:
- assert False
-
- def test_removedata(self):
- """
- Remove the test data we added
- """
- # Remove the host
- res = api.Command['host_del'](self.host_fqdn)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['host_show'](self.host_fqdn)
- except errors.NotFound:
- pass
- else:
- assert False
-
- # Remove the hostgroup
- res = api.Command['hostgroup_del'](self.hg_cn)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['hostgroup_show'](self.hg_cn)
- except errors.NotFound:
- pass
- else:
- assert False
-
- # Remove the user
- res = api.Command['user_del'](self.user_uid)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['user_show'](self.user_uid)
- except errors.NotFound:
- pass
- else:
- assert False
-
- # Remove the group
- res = api.Command['group_del'](self.group_cn)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['group_show'](self.group_cn)
- except errors.NotFound:
- pass
- else:
- assert False
diff --git a/tests/test_xmlrpc/test_rolegroup_plugin.py b/tests/test_xmlrpc/test_rolegroup_plugin.py
deleted file mode 100644
index 37135b2e2..000000000
--- a/tests/test_xmlrpc/test_rolegroup_plugin.py
+++ /dev/null
@@ -1,143 +0,0 @@
-# Authors:
-# Rob Crittenden <rcritten@redhat.com>
-#
-# Copyright (C) 2009 Red Hat
-# see file 'COPYING' for use and warranty information
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2 only
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-"""
-Test the `ipalib/plugins/rolegroup` module.
-"""
-
-import sys
-from xmlrpc_test import XMLRPC_test
-from ipalib import api
-from ipalib import errors
-
-
-class test_Rolegroup(XMLRPC_test):
- """
- Test the `rolegroup` plugin.
- """
- cn=u'testgroup'
- description=u'Test role group'
- kw={'cn': cn, 'description': description}
-
- rolegroup_cn = u'ipatestgroup'
- rolegroup_description = u'Test group for rolegroups'
-
- def test_add(self):
- """
- Test the `xmlrpc.rolegroup_add` method.
- """
- res = api.Command['rolegroup_add'](**self.kw)
- assert res
- assert res.get('description','') == self.description
- assert res.get('cn','') == self.cn
-
- def test_addrolegroup(self):
- """
- Add a group to test add/remove member.
- """
- kw={'cn': self.rolegroup_cn, 'description': self.rolegroup_description}
- res = api.Command['group_add'](**kw)
- assert res
- assert res.get('description','') == self.rolegroup_description
- assert res.get('cn','') == self.rolegroup_cn
-
- def test_addrolegroupmember(self):
- """
- Test the `xmlrpc.rolegroup_add_member` method.
- """
- kw={}
- kw['groups'] = self.rolegroup_cn
- res = api.Command['rolegroup_add_member'](self.cn, **kw)
- assert res == tuple()
-
- def test_doshow(self):
- """
- Test the `xmlrpc.rolegroup_show` method.
- """
- res = api.Command['rolegroup_show'](self.cn)
- assert res
- assert res.get('description','') == self.description
- assert res.get('cn','') == self.cn
- assert res.get('member','').startswith('cn=%s' % self.rolegroup_cn)
-
- def test_find(self):
- """
- Test the `xmlrpc.rolegroup_find` method.
- """
- res = api.Command['rolegroup_find'](self.cn)
- assert res
- 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.rolegroup_cn)
-
- def test_mod(self):
- """
- Test the `xmlrpc.rolegroup_mod` method.
- """
- newdesc=u'Updated role group'
- modkw={'cn': self.cn, 'description': newdesc}
- res = api.Command['rolegroup_mod'](**modkw)
- assert res
- assert res.get('description','') == newdesc
-
- # Ok, double-check that it was changed
- res = api.Command['rolegroup_show'](self.cn)
- assert res
- assert res.get('description','') == newdesc
- assert res.get('cn','') == self.cn
-
- def test_member_remove(self):
- """
- Test the `xmlrpc.rolegroup_remove_member` method.
- """
- kw={}
- kw['roles'] = self.rolegroup_cn
- res = api.Command['rolegroup_remove_member'](self.cn, **kw)
- assert res == tuple()
-
- def test_remove(self):
- """
- Test the `xmlrpc.rolegroup_del` method.
- """
- res = api.Command['rolegroup_del'](self.cn)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['rolegroup_show'](self.cn)
- except errors.NotFound:
- pass
- else:
- assert False
-
- def test_removerole(self):
- """
- Remove the group we created for member testing
- """
- res = api.Command['group_del'](self.rolegroup_cn)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['group_show'](self.rolegroup_cn)
- except errors.NotFound:
- pass
- else:
- assert False
diff --git a/tests/test_xmlrpc/test_service_plugin.py b/tests/test_xmlrpc/test_service_plugin.py
deleted file mode 100644
index d1b348ee2..000000000
--- a/tests/test_xmlrpc/test_service_plugin.py
+++ /dev/null
@@ -1,113 +0,0 @@
-# Authors:
-# Rob Crittenden <rcritten@redhat.com>
-#
-# Copyright (C) 2008 Red Hat
-# see file 'COPYING' for use and warranty information
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2 only
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-"""
-Test the `ipalib/plugins/f_service` module.
-"""
-
-import sys
-from xmlrpc_test import XMLRPC_test
-from ipalib import api
-from ipalib import errors
-
-
-class test_Service(XMLRPC_test):
- """
- Test the `f_service` plugin.
- """
- 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):
- """
- Test adding a HTTP principal using the `xmlrpc.service_add` method.
- """
- res = api.Command['service_add'](**self.kw)
- assert res
- assert res.get('krbprincipalname','') == self.principal
-
- def test_add_host(self):
- """
- 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:
- pass
- else:
- assert False
-
- def test_add_malformed1(self):
- """
- Test adding a malformed principal ('foo').
- """
- kw={'principal': u'foo'}
- try:
- res = api.Command['service_add'](**kw)
- except errors.MalformedServicePrincipal:
- pass
- else:
- assert False
-
- def test_add_wrongrealm(self):
- """
- Test adding a malformed principal ('HTTP/foo@FOO.NET').
- """
- kw={'principal': u'HTTP/foo@FOO.NET'}
- try:
- res = api.Command['service_add'](**kw)
- except errors.RealmMismatch:
- pass
- else:
- assert False
-
- def test_doshow(self):
- """
- Test the `xmlrpc.service_show` method.
- """
- res = api.Command['service_show'](self.principal)
- assert res
- assert res.get('krbprincipalname','') == self.principal
-
- def test_find(self):
- """
- Test the `xmlrpc.service_find` method.
- """
- res = api.Command['service_find'](self.principal)
- assert res
- assert len(res) == 2
- assert res[1].get('krbprincipalname','') == self.principal
-
- def test_remove(self):
- """
- Test the `xmlrpc.service_del` method.
- """
- res = api.Command['service_del'](self.principal)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['service_show'](self.principal)
- except errors.NotFound:
- pass
- else:
- assert False
diff --git a/tests/test_xmlrpc/test_taskgroup_plugin.py b/tests/test_xmlrpc/test_taskgroup_plugin.py
deleted file mode 100644
index 4dc7228f1..000000000
--- a/tests/test_xmlrpc/test_taskgroup_plugin.py
+++ /dev/null
@@ -1,188 +0,0 @@
-# Authors:
-# Rob Crittenden <rcritten@redhat.com>
-#
-# Copyright (C) 2009 Red Hat
-# see file 'COPYING' for use and warranty information
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2 only
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-"""
-Test the `ipalib/plugins/taskgroup` module.
-"""
-
-import sys
-from xmlrpc_test import XMLRPC_test
-from ipalib import api
-from ipalib import errors
-
-
-class test_Taskgroup(XMLRPC_test):
- """
- Test the `taskgroup` plugin.
- """
- cn=u'testgroup'
- description=u'Test task group'
- kw={'cn': cn, 'description': description}
-
- taskgroup_cn = u'ipatestgroup'
- taskgroup_description = u'Test group for taskgroups'
-
- rolegroup_cn = u'iparolegroup'
- rolegroup_description = u'Test rolegroup for taskgroups'
-
- def test_add(self):
- """
- Test the `xmlrpc.taskgroup_add` method.
- """
- res = api.Command['taskgroup_add'](**self.kw)
- assert res
- assert res.get('description','') == self.description
- assert res.get('cn','') == self.cn
-
- def test_addrolegroup(self):
- """
- Add a rolegroup to test add/remove member.
- """
- kw={'cn': self.rolegroup_cn, 'description': self.rolegroup_description}
- res = api.Command['rolegroup_add'](**kw)
- assert res
- assert res.get('description','') == self.rolegroup_description
- assert res.get('cn','') == self.rolegroup_cn
-
- def test_addtaskgroup(self):
- """
- Add a group to test add/remove member.
- """
- kw={'cn': self.taskgroup_cn, 'description': self.taskgroup_description}
- res = api.Command['group_add'](**kw)
- assert res
- assert res.get('description','') == self.taskgroup_description
- assert res.get('cn','') == self.taskgroup_cn
-
- def test_addtaskgroupmember(self):
- """
- Test the `xmlrpc.taskgroup_add_member` method.
- """
- kw={}
- kw['groups'] = self.taskgroup_cn
- kw['rolegroups'] = self.rolegroup_cn
- res = api.Command['taskgroup_add_member'](self.cn, **kw)
- assert res == tuple()
-
- def test_doshow(self):
- """
- Test the `xmlrpc.taskgroup_show` method.
- """
- res = api.Command['taskgroup_show'](self.cn)
- assert res
- assert res.get('description','') == self.description
- assert res.get('cn','') == self.cn
- foundrole = False
- foundtask = False
- members = res.get('member',[])
- for m in members:
- if m.startswith('cn=%s' % self.taskgroup_cn): foundtask=True
- if m.startswith('cn=%s' % self.rolegroup_cn): foundrole=True
-
- if not foundtask and foundrole:
- assert False
-
- def test_find(self):
- """
- Test the `xmlrpc.taskgroup_find` method.
- """
- res = api.Command['taskgroup_find'](self.cn)
- assert res
- assert len(res) == 2, res
- assert res[1].get('description','') == self.description
- assert res[1].get('cn','') == self.cn
- members = res[1].get('member',[])
- foundrole = False
- foundtask = False
- for m in members:
- if m.startswith('cn=%s' % self.taskgroup_cn): foundtask=True
- if m.startswith('cn=%s' % self.rolegroup_cn): foundrole=True
-
- if not foundtask and foundrole:
- assert False
-
- def test_mod(self):
- """
- Test the `xmlrpc.taskgroup_mod` method.
- """
- newdesc=u'Updated task group'
- modkw={'cn': self.cn, 'description': newdesc}
- res = api.Command['taskgroup_mod'](**modkw)
- assert res
- assert res.get('description','') == newdesc
-
- # Ok, double-check that it was changed
- res = api.Command['taskgroup_show'](self.cn)
- assert res
- assert res.get('description','') == newdesc
- assert res.get('cn','') == self.cn
-
- def test_member_remove(self):
- """
- Test the `xmlrpc.taskgroup_remove_member` method.
- """
- kw={}
- kw['tasks'] = self.taskgroup_cn
- res = api.Command['taskgroup_remove_member'](self.cn, **kw)
- assert res == tuple()
-
- def test_remove(self):
- """
- Test the `xmlrpc.taskgroup_del` method.
- """
- res = api.Command['taskgroup_del'](self.cn)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['taskgroup_show'](self.cn)
- except errors.NotFound:
- pass
- else:
- assert False
-
- def test_removetask(self):
- """
- Remove the group we created for member testing
- """
- res = api.Command['group_del'](self.taskgroup_cn)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['group_show'](self.taskgroup_cn)
- except errors.NotFound:
- pass
- else:
- assert False
-
- def test_removerolegroup(self):
- """
- Remove the rolegroup we created for member testing
- """
- res = api.Command['rolegroup_del'](self.rolegroup_cn)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['rolegroup_show'](self.rolegroup_cn)
- except errors.NotFound:
- pass
- else:
- assert False
diff --git a/tests/test_xmlrpc/test_user_plugin.py b/tests/test_xmlrpc/test_user_plugin.py
deleted file mode 100644
index 87334045b..000000000
--- a/tests/test_xmlrpc/test_user_plugin.py
+++ /dev/null
@@ -1,146 +0,0 @@
-# Authors:
-# Rob Crittenden <rcritten@redhat.com>
-#
-# Copyright (C) 2008 Red Hat
-# see file 'COPYING' for use and warranty information
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2 only
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-"""
-Test the `ipalib/plugins/f_user` module.
-"""
-
-import sys
-from xmlrpc_test import XMLRPC_test
-from ipalib import api
-from ipalib import errors
-
-
-class test_User(XMLRPC_test):
- """
- Test the `f_user` plugin.
- """
- 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):
- """
- Test the `xmlrpc.user_add` method.
- """
- res = api.Command['user_add'](**self.kw)
- assert res
- assert res.get('givenname','') == self.givenname
- assert res.get('sn','') == self.sn
- assert res.get('uid','') == self.uid
- assert res.get('homedirectory','') == self.home
-
- def test_add2(self):
- """
- Test the `xmlrpc.user_add` method duplicate detection.
- """
- try:
- res = api.Command['user_add'](**self.kw)
- except errors.DuplicateEntry:
- pass
-
- def test_doshow(self):
- """
- Test the `xmlrpc.user_show` method.
- """
- kw={'uid':self.uid, 'all': True}
- res = api.Command['user_show'](**kw)
- assert res
- assert res.get('givenname','') == self.givenname
- assert res.get('sn','') == self.sn
- assert res.get('uid','') == self.uid
- assert res.get('homedirectory','') == self.home
- assert res.get('krbprincipalname','') == self.principalname
-
- def test_find_all(self):
- """
- Test the `xmlrpc.user_find` method with all attributes.
- """
- kw={'all': True}
- res = api.Command['user_find'](self.uid, **kw)
- assert res
- assert len(res) == 2
- assert res[1].get('givenname','') == self.givenname
- assert res[1].get('sn','') == self.sn
- assert res[1].get('uid','') == self.uid
- assert res[1].get('homedirectory','') == self.home
- assert res[1].get('krbprincipalname','') == self.principalname
-
- def test_find_minimal(self):
- """
- Test the `xmlrpc.user_find` method with minimal attributes.
- """
- res = api.Command['user_find'](self.uid)
- assert res
- assert len(res) == 2
- assert res[1].get('givenname','') == self.givenname
- assert res[1].get('sn','') == self.sn
- assert res[1].get('uid','') == self.uid
- assert res[1].get('homedirectory','') == self.home
- assert res[1].get('krbprincipalname', None) == None
-
- def test_lock(self):
- """
- Test the `xmlrpc.user_lock` method.
- """
- res = api.Command['user_lock'](self.uid)
- assert res == True
-
- def test_lockoff(self):
- """
- Test the `xmlrpc.user_unlock` method.
- """
- res = api.Command['user_unlock'](self.uid)
- assert res == True
-
- def test_mod(self):
- """
- Test the `xmlrpc.user_mod` method.
- """
- modkw = self.kw
- modkw['givenname'] = u'Finkle'
- res = api.Command['user_mod'](**modkw)
- assert res
- assert res.get('givenname','') == 'Finkle'
- assert res.get('sn','') == self.sn
-
- # Ok, double-check that it was changed
- res = api.Command['user_show'](self.uid)
- assert res
- assert res.get('givenname','') == u'Finkle'
- assert res.get('sn','') == self.sn
- assert res.get('uid','') == self.uid
-
- def test_remove(self):
- """
- Test the `xmlrpc.user_del` method.
- """
- res = api.Command['user_del'](self.uid)
- assert res == True
-
- # Verify that it is gone
- try:
- res = api.Command['user_show'](self.uid)
- except errors.NotFound:
- pass
- else:
- assert False