diff options
author | Petr Viktorin <pviktori@redhat.com> | 2012-04-10 07:44:21 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2012-04-09 21:53:22 -0400 |
commit | 32fa7f7a48b3d956b0ec5dbea9cd22db504a562d (patch) | |
tree | aa07a56ab7fb17af8258aedfc6d0b748f7675f4c /tests | |
parent | 04427136b097daebedbb08532c935f605b908905 (diff) | |
download | freeipa.git-32fa7f7a48b3d956b0ec5dbea9cd22db504a562d.tar.gz freeipa.git-32fa7f7a48b3d956b0ec5dbea9cd22db504a562d.tar.xz freeipa.git-32fa7f7a48b3d956b0ec5dbea9cd22db504a562d.zip |
Convert --setattr values for attributes marked no_update
Attribute Patrams marked no_update never get cloned to Update commands,
and thus never receive the `attribute` flag. This makes their `encode`
method a no-op, which meant they don't get properly encoded when used
with --setattr, making the --setattr fail.
Introduce a `force` argument to encode, which overrides checking
for the attribute flag. Use this in set/add/delattr normalization,
where we know we are dealing with attributes.
https://fedorahosted.org/freeipa/ticket/2616
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_xmlrpc/test_attr.py | 2 | ||||
-rw-r--r-- | tests/test_xmlrpc/test_hbac_plugin.py | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/tests/test_xmlrpc/test_attr.py b/tests/test_xmlrpc/test_attr.py index e6872a67..c19a6948 100644 --- a/tests/test_xmlrpc/test_attr.py +++ b/tests/test_xmlrpc/test_attr.py @@ -433,7 +433,7 @@ class test_attr(Declarative): command=( 'user_mod', [user1], dict( addattr=u'nsaccountlock=FaLsE', - delattr=u'nsaccountlock=True') + delattr=u'nsaccountlock=TRUE') ), expected=dict( result=dict( diff --git a/tests/test_xmlrpc/test_hbac_plugin.py b/tests/test_xmlrpc/test_hbac_plugin.py index 78c4973c..c7cb55ba 100644 --- a/tests/test_xmlrpc/test_hbac_plugin.py +++ b/tests/test_xmlrpc/test_hbac_plugin.py @@ -430,6 +430,27 @@ class test_hbac(XMLRPC_test): # FIXME: Should this be 'enabled' or 'TRUE'? assert_attr_equal(entry, 'ipaenabledflag', 'TRUE') + def test_ea_hbacrule_disable_setattr(self): + """ + Test disabling HBAC rule using setattr + """ + command_result = api.Command['hbacrule_mod']( + self.rule_name, setattr=u'ipaenabledflag=false') + assert command_result['result']['ipaenabledflag'] == (u'FALSE',) + entry = api.Command['hbacrule_show'](self.rule_name)['result'] + assert_attr_equal(entry, 'ipaenabledflag', 'FALSE') + + def test_eb_hbacrule_enable_setattr(self): + """ + Test enabling HBAC rule using setattr + """ + command_result = api.Command['hbacrule_mod']( + self.rule_name, setattr=u'ipaenabledflag=1') + assert command_result['result']['ipaenabledflag'] == (u'TRUE',) + # check it's really enabled + entry = api.Command['hbacrule_show'](self.rule_name)['result'] + assert_attr_equal(entry, 'ipaenabledflag', 'TRUE') + @raises(errors.MutuallyExclusiveError) def test_f_hbacrule_exclusiveuser(self): """ |