On 09/29/2014 10:22 AM, Martin Kosek wrote:
On 09/29/2014 10:09 AM, David Kupka wrote:
https://fedorahosted.org/freeipa/ticket/4387


The changes look OK so far, except the test fix.

The test_batch_plugin.py test is apparently testing that batch command behaves
well in RequirementError for options. Thus, we should not remove it, we should
just pick different option. Like filling uid+first options with user-add, but
missing the --last option.

Martin


Ok, but the test is bit redundant as there is already test for missing givenname that should behave the same way.

--
David Kupka
From 1e661dc28aaec2d9e1cffb873c193da7221eefd9 Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Fri, 26 Sep 2014 02:54:28 -0400
Subject: [PATCH] Do not require description in UI.

Description attribute is not required in LDAP schema so there is no reason to
require it in UI. Modified tests to reflect this change.

https://fedorahosted.org/freeipa/ticket/4387
---
 API.txt                                   | 14 +++++++-------
 ipalib/plugins/group.py                   |  2 +-
 ipalib/plugins/hbacsvcgroup.py            |  2 +-
 ipalib/plugins/hostgroup.py               |  2 +-
 ipalib/plugins/netgroup.py                |  2 +-
 ipalib/plugins/privilege.py               |  2 +-
 ipalib/plugins/role.py                    |  2 +-
 ipalib/plugins/sudocmdgroup.py            |  2 +-
 ipatests/test_cmdline/test_cli.py         |  1 -
 ipatests/test_xmlrpc/test_batch_plugin.py |  5 +++--
 10 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/API.txt b/API.txt
index bbd0f507b2faeec0239920cdcff28fe25d618e02..d8078b98a7ea7f2e51e4eec7f04b7321781318c7 100644
--- a/API.txt
+++ b/API.txt
@@ -1296,7 +1296,7 @@ args: 1,10,3
 arg: Str('cn', attribute=True, cli_name='group_name', maxlength=255, multivalue=False, pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$', primary_key=True, required=True)
 option: Str('addattr*', cli_name='addattr', exclude='webui')
 option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
-option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=True)
+option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=False)
 option: Flag('external', autofill=True, cli_name='external', default=False)
 option: Int('gidnumber', attribute=True, cli_name='gid', minvalue=1, multivalue=False, required=False)
 option: Flag('no_members', autofill=True, default=False, exclude='webui')
@@ -1681,7 +1681,7 @@ args: 1,7,3
 arg: Str('cn', attribute=True, cli_name='name', multivalue=False, primary_key=True, required=True)
 option: Str('addattr*', cli_name='addattr', exclude='webui')
 option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
-option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=True)
+option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=False)
 option: Flag('no_members', autofill=True, default=False, exclude='webui')
 option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
 option: Str('setattr*', cli_name='setattr', exclude='webui')
@@ -1931,7 +1931,7 @@ args: 1,7,3
 arg: Str('cn', attribute=True, cli_name='hostgroup_name', multivalue=False, pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]*$', primary_key=True, required=True)
 option: Str('addattr*', cli_name='addattr', exclude='webui')
 option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
-option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=True)
+option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=False)
 option: Flag('no_members', autofill=True, default=False, exclude='webui')
 option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
 option: Str('setattr*', cli_name='setattr', exclude='webui')
@@ -2180,7 +2180,7 @@ args: 1,11,3
 arg: Str('cn', attribute=True, cli_name='name', multivalue=False, pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]*$', primary_key=True, required=True)
 option: Str('addattr*', cli_name='addattr', exclude='webui')
 option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
-option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=True)
+option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=False)
 option: Str('externalhost', attribute=True, cli_name='externalhost', multivalue=True, required=False)
 option: StrEnum('hostcategory', attribute=True, cli_name='hostcat', multivalue=False, required=False, values=(u'all',))
 option: Str('nisdomainname', attribute=True, cli_name='nisdomain', multivalue=False, pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]*$', required=False)
@@ -2608,7 +2608,7 @@ args: 1,7,3
 arg: Str('cn', attribute=True, cli_name='name', multivalue=False, primary_key=True, required=True)
 option: Str('addattr*', cli_name='addattr', exclude='webui')
 option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
-option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=True)
+option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=False)
 option: Flag('no_members', autofill=True, default=False, exclude='webui')
 option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
 option: Str('setattr*', cli_name='setattr', exclude='webui')
@@ -2900,7 +2900,7 @@ args: 1,7,3
 arg: Str('cn', attribute=True, cli_name='name', multivalue=False, primary_key=True, required=True)
 option: Str('addattr*', cli_name='addattr', exclude='webui')
 option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
-option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=True)
+option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=False)
 option: Flag('no_members', autofill=True, default=False, exclude='webui')
 option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
 option: Str('setattr*', cli_name='setattr', exclude='webui')
@@ -3377,7 +3377,7 @@ args: 1,7,3
 arg: Str('cn', attribute=True, cli_name='sudocmdgroup_name', multivalue=False, primary_key=True, required=True)
 option: Str('addattr*', cli_name='addattr', exclude='webui')
 option: Flag('all', autofill=True, cli_name='all', default=False, exclude='webui')
-option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=True)
+option: Str('description', attribute=True, cli_name='desc', multivalue=False, required=False)
 option: Flag('no_members', autofill=True, default=False, exclude='webui')
 option: Flag('raw', autofill=True, cli_name='raw', default=False, exclude='webui')
 option: Str('setattr*', cli_name='setattr', exclude='webui')
diff --git a/ipalib/plugins/group.py b/ipalib/plugins/group.py
index 8d2e69f062ec9bcf2de2af77efc2aec2cc8b51ca..9c2e308204ab4a9a9efe66db99ac3abe4f6e9694 100644
--- a/ipalib/plugins/group.py
+++ b/ipalib/plugins/group.py
@@ -227,7 +227,7 @@ class group(LDAPObject):
             primary_key=True,
             normalizer=lambda value: value.lower(),
         ),
-        Str('description',
+        Str('description?',
             cli_name='desc',
             label=_('Description'),
             doc=_('Group description'),
diff --git a/ipalib/plugins/hbacsvcgroup.py b/ipalib/plugins/hbacsvcgroup.py
index a5a22c20869db86e14c2cd20c2becd516d7b37df..2bc92cb24229912705d56982a3eabd33e0a93815 100644
--- a/ipalib/plugins/hbacsvcgroup.py
+++ b/ipalib/plugins/hbacsvcgroup.py
@@ -107,7 +107,7 @@ class hbacsvcgroup(LDAPObject):
             primary_key=True,
             normalizer=lambda value: value.lower(),
         ),
-        Str('description',
+        Str('description?',
             cli_name='desc',
             label=_('Description'),
             doc=_('HBAC service group description'),
diff --git a/ipalib/plugins/hostgroup.py b/ipalib/plugins/hostgroup.py
index 0e86e99202bb69e8c7a82ecaff09e9383403bb09..4161cb1ba30ecd7a1b5586be7a4c9f62b94d011c 100644
--- a/ipalib/plugins/hostgroup.py
+++ b/ipalib/plugins/hostgroup.py
@@ -139,7 +139,7 @@ class hostgroup(LDAPObject):
             primary_key=True,
             normalizer=lambda value: value.lower(),
         ),
-        Str('description',
+        Str('description?',
             cli_name='desc',
             label=_('Description'),
             doc=_('A description of this host-group'),
diff --git a/ipalib/plugins/netgroup.py b/ipalib/plugins/netgroup.py
index da2808f5acc2499b56aead94005fdea92bca7b00..d535b383e048fd12d08bde9247f158d183a5bcad 100644
--- a/ipalib/plugins/netgroup.py
+++ b/ipalib/plugins/netgroup.py
@@ -184,7 +184,7 @@ class netgroup(LDAPObject):
             primary_key=True,
             normalizer=lambda value: value.lower(),
         ),
-        Str('description',
+        Str('description?',
             cli_name='desc',
             label=_('Description'),
             doc=_('Netgroup description'),
diff --git a/ipalib/plugins/privilege.py b/ipalib/plugins/privilege.py
index 6a503709e025554bb25911ab89fc6f7e4b1dcdcb..867544359f76fdcb44cd3015f7466a46ba492bec 100644
--- a/ipalib/plugins/privilege.py
+++ b/ipalib/plugins/privilege.py
@@ -102,7 +102,7 @@ class privilege(LDAPObject):
             label=_('Privilege name'),
             primary_key=True,
         ),
-        Str('description',
+        Str('description?',
             cli_name='desc',
             label=_('Description'),
             doc=_('Privilege description'),
diff --git a/ipalib/plugins/role.py b/ipalib/plugins/role.py
index f2021d3fa39a4dc569c74f150e572f366fd34ff4..55afece22165a550d570fff3aa9f25d103d20b7a 100644
--- a/ipalib/plugins/role.py
+++ b/ipalib/plugins/role.py
@@ -134,7 +134,7 @@ class role(LDAPObject):
             label=_('Role name'),
             primary_key=True,
         ),
-        Str('description',
+        Str('description?',
             cli_name='desc',
             label=_('Description'),
             doc=_('A description of this role-group'),
diff --git a/ipalib/plugins/sudocmdgroup.py b/ipalib/plugins/sudocmdgroup.py
index 40ff294bbf3a8e2547f83f626ced6e2122231818..74bbaf095b79efb615dc71ca2fa357b14320e1a7 100644
--- a/ipalib/plugins/sudocmdgroup.py
+++ b/ipalib/plugins/sudocmdgroup.py
@@ -117,7 +117,7 @@ class sudocmdgroup(LDAPObject):
             primary_key=True,
             normalizer=lambda value: value.lower(),
         ),
-        Str('description',
+        Str('description?',
             cli_name='desc',
             label=_('Description'),
             doc=_('Group description'),
diff --git a/ipatests/test_cmdline/test_cli.py b/ipatests/test_cmdline/test_cli.py
index 489d2ceb3536c2aa08cea0c4fe7ad3321668400f..008da3bd80fe45933cb877801156aa5cbe4d93c1 100644
--- a/ipatests/test_cmdline/test_cli.py
+++ b/ipatests/test_cmdline/test_cli.py
@@ -117,7 +117,6 @@ class TestCLIParsing(object):
         with self.fake_stdin('Test group\n'):
             self.check_command('group-add tgroup1', 'group_add',
                 cn=u'tgroup1',
-                description=u'Test group',
                 nonposix=False,
                 external=False,
                 no_members=False,
diff --git a/ipatests/test_xmlrpc/test_batch_plugin.py b/ipatests/test_xmlrpc/test_batch_plugin.py
index 7f5a09fc776fd14c5cf1901a8fcc81a98390a643..a2bde22e887afb37ebbab81dcfc3e3cd1062952a 100644
--- a/ipatests/test_xmlrpc/test_batch_plugin.py
+++ b/ipatests/test_xmlrpc/test_batch_plugin.py
@@ -28,6 +28,7 @@ from xmlrpc_test import Declarative, fuzzy_digits, fuzzy_uuid
 from ipapython.dn import DN
 
 group1 = u'testgroup1'
+first1 = u'John'
 
 
 def deepequal_list(*expected):
@@ -182,7 +183,7 @@ class test_batch(Declarative):
                 # missing required argument
                 dict(method='user_add', params=([], dict())),
                 # missing required option
-                dict(method='group_add', params=([group1], dict())),
+                dict(method='user_add', params=([], dict(givenname=first1))),
                 # bad type
                 dict(method='group_add', params=([group1], dict(
                         description=u't', gidnumber=u'bad'))),
@@ -216,7 +217,7 @@ class test_batch(Declarative):
                         error_code=3007,
                     ),
                     dict(
-                        error=u"'description' is required",
+                        error=u"'sn' is required",
                         error_name=u'RequirementError',
                         error_code=3007,
                     ),
-- 
1.9.3

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to