diff options
author | Sumit Bose <sbose@redhat.com> | 2012-06-13 20:58:54 +0200 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2012-06-29 18:00:50 -0400 |
commit | fbebe82811b621c79431f914b413164fbca738ca (patch) | |
tree | 72a666535babfc266d393a01ac30995cf9d6a357 /tests | |
parent | e809802aedb2d0343fb8fd7e42c2cfd9ed327cc9 (diff) | |
download | freeipa-fbebe82811b621c79431f914b413164fbca738ca.tar.gz freeipa-fbebe82811b621c79431f914b413164fbca738ca.tar.xz freeipa-fbebe82811b621c79431f914b413164fbca738ca.zip |
Add CLI for ID ranges
https://fedorahosted.org/freeipa/ticket/2185
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_xmlrpc/test_range_plugin.py | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/tests/test_xmlrpc/test_range_plugin.py b/tests/test_xmlrpc/test_range_plugin.py new file mode 100644 index 000000000..7c95cd57a --- /dev/null +++ b/tests/test_xmlrpc/test_range_plugin.py @@ -0,0 +1,79 @@ +# Authors: +# Alexander Bokovoy <abokovoy@redhat.com> +# +# Copyright (C) 2012 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, either version 3 of the License, or +# (at your option) any later version. +# +# 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, see <http://www.gnu.org/licenses/>. + +""" +Test the `ipalib/plugins/range.py` module, and XML-RPC in general. +""" + +from ipalib import api, errors, _ +from tests.util import assert_equal, Fuzzy +from xmlrpc_test import Declarative +from ipalib.dn import * + +testrange1 = u't-range-1' + +class test_range(Declarative): + cleanup_commands = [ + ('range_del', [testrange1], {}), + ] + + tests = [ + dict( + desc='Create range %r' % (testrange1), + command=('range_add', [testrange1], + dict(ipabaseid=900000, ipaidrangesize=99999, + ipabaserid=1000, ipasecondarybaserid=20000)), + expected=dict( + result=dict( + dn=lambda x: DN(x) == \ + DN(('cn',testrange1),('cn','ranges'),('cn','etc'), + api.env.basedn), + cn=[testrange1], + objectclass=[u'ipaIDrange', u'ipadomainidrange'], + ipabaseid=[u'900000'], + ipabaserid=[u'1000'], + ipasecondarybaserid=[u'20000'], + ipaidrangesize=[u'99999'] + ), + value=testrange1, + summary=u'Added ID range "%s"' % (testrange1), + ), + ), + + dict( + desc='Retrieve range %r' % (testrange1), + command=('range_show', [testrange1], dict()), + expected=dict( + result=dict( + dn=lambda x: DN(x) == \ + DN(('cn',testrange1),('cn','ranges'),('cn','etc'), + api.env.basedn), + cn=[testrange1], + ipabaseid=[u'900000'], + ipabaserid=[u'1000'], + ipasecondarybaserid=[u'20000'], + ipaidrangesize=[u'99999'], + iparangetype=u'local domain range', + ), + value=testrange1, + summary=None, + ), + ), + + ] |