Use valid argument names in tests

Some of our tests used unintended extra options, or options with
misspelled, wrongly copy-pasted or otherwise bad names. These are
ignored, so the intended argument was treated as missing. The test
itself can still pass but may be rendered ineffective or fragile.

This only fixes those of such errors that appear in the test suite.
Fixing code in the framework and actual rejecting of unknown
arguments is deferred for later (ticket #2509).
This commit is contained in:
Petr Viktorin 2012-03-14 11:33:41 -04:00 committed by Rob Crittenden
parent a735420a9b
commit 0b01751c1b
8 changed files with 12 additions and 15 deletions

View File

@ -718,10 +718,7 @@ class test_automember(Declarative):
dict( dict(
desc='Retrieve default automember group for groups', desc='Retrieve default automember group for groups',
command=( command=(
'automember_default_group_show', [], dict( 'automember_default_group_show', [], dict(type=u'group')
type=u'group',
automemberdefaultgroup=defaultgroup1,
)
), ),
expected=dict( expected=dict(
result=dict( result=dict(

View File

@ -45,7 +45,7 @@ class test_delegation(Declarative):
dict( dict(
desc='Try to update non-existent %r' % delegation1, desc='Try to update non-existent %r' % delegation1,
command=('delegation_mod', [delegation1], dict(description=u'Foo')), command=('delegation_mod', [delegation1], dict(group=u'admins')),
expected=errors.NotFound(reason='no such entry'), expected=errors.NotFound(reason='no such entry'),
), ),

View File

@ -123,7 +123,7 @@ class test_hbac(XMLRPC_test):
Test searching for HBAC rules using `xmlrpc.hbacrule_find`. Test searching for HBAC rules using `xmlrpc.hbacrule_find`.
""" """
ret = api.Command['hbacrule_find']( ret = api.Command['hbacrule_find'](
name=self.rule_name, accessruletype=self.rule_type, cn=self.rule_name, accessruletype=self.rule_type,
description=self.rule_desc_mod description=self.rule_desc_mod
) )
assert ret['truncated'] is False assert ret['truncated'] is False
@ -155,7 +155,7 @@ class test_hbac(XMLRPC_test):
self.test_sourcehostgroup, description=u'desc' self.test_sourcehostgroup, description=u'desc'
) )
self.failsafe_add(api.Object.hbacsvc, self.failsafe_add(api.Object.hbacsvc,
self.test_service, description=u'desc', force=True self.test_service, description=u'desc',
) )
def test_8_hbacrule_add_user(self): def test_8_hbacrule_add_user(self):
@ -424,7 +424,7 @@ class test_hbac(XMLRPC_test):
""" """
api.Command['hbacrule_mod'](self.rule_name, usercategory=u'all') api.Command['hbacrule_mod'](self.rule_name, usercategory=u'all')
try: try:
api.Command['hbacrule_add_user'](self.rule_name, users=u'admin') api.Command['hbacrule_add_user'](self.rule_name, user=u'admin')
finally: finally:
api.Command['hbacrule_mod'](self.rule_name, usercategory=u'') api.Command['hbacrule_mod'](self.rule_name, usercategory=u'')

View File

@ -79,7 +79,7 @@ class test_hbactest(XMLRPC_test):
self.test_sourcehostgroup, description=u'desc' self.test_sourcehostgroup, description=u'desc'
) )
self.failsafe_add(api.Object.hbacsvc, self.failsafe_add(api.Object.hbacsvc,
self.test_service, description=u'desc', force=True self.test_service, description=u'desc'
) )
for i in [0,1,2,3]: for i in [0,1,2,3]:

View File

@ -123,7 +123,7 @@ class test_host(Declarative):
command=('host_add', [fqdn1], command=('host_add', [fqdn1],
dict( dict(
description=u'Test host 1', description=u'Test host 1',
localityname=u'Undisclosed location 1', locality=u'Undisclosed location 1',
force=True, force=True,
), ),
), ),

View File

@ -49,7 +49,7 @@ class test_pwpolicy(XMLRPC_test):
self.failsafe_add( self.failsafe_add(
api.Object.user, self.user, givenname=u'Test', sn=u'User' api.Object.user, self.user, givenname=u'Test', sn=u'User'
) )
api.Command.group_add_member(self.group, users=self.user) api.Command.group_add_member(self.group, user=self.user)
entry = api.Command['pwpolicy_add'](self.group, **self.kw)['result'] entry = api.Command['pwpolicy_add'](self.group, **self.kw)['result']
assert_attr_equal(entry, 'krbminpwdlife', '30') assert_attr_equal(entry, 'krbminpwdlife', '30')

View File

@ -81,7 +81,7 @@ class test_role(Declarative):
dict( dict(
desc='Try to rename non-existent %r' % role1, desc='Try to rename non-existent %r' % role1,
command=('role_del', [role1], dict(setattr=u'cn=%s' % renamedrole1)), command=('role_mod', [role1], dict(setattr=u'cn=%s' % renamedrole1)),
expected=errors.NotFound(reason='no such entry'), expected=errors.NotFound(reason='no such entry'),
), ),

View File

@ -97,7 +97,7 @@ class test_sudorule(XMLRPC_test):
Test searching for Sudo rules using `xmlrpc.sudorule_find`. Test searching for Sudo rules using `xmlrpc.sudorule_find`.
""" """
ret = api.Command['sudorule_find']( ret = api.Command['sudorule_find'](
name=self.rule_name, cn=self.rule_name,
description=self.rule_desc_mod description=self.rule_desc_mod
) )
assert ret['truncated'] is False assert ret['truncated'] is False
@ -131,7 +131,7 @@ class test_sudorule(XMLRPC_test):
self.test_sudodenycmdgroup, description=u'desc' self.test_sudodenycmdgroup, description=u'desc'
) )
self.failsafe_add(api.Object.sudocmd, self.failsafe_add(api.Object.sudocmd,
self.test_command, description=u'desc', force=True self.test_command, description=u'desc'
) )
def test_8_sudorule_add_user(self): def test_8_sudorule_add_user(self):
@ -592,7 +592,7 @@ class test_sudorule(XMLRPC_test):
""" """
api.Command['sudorule_mod'](self.rule_name, ipasudorunasusercategory=u'all') api.Command['sudorule_mod'](self.rule_name, ipasudorunasusercategory=u'all')
try: try:
api.Command['sudorule_add_runasuser'](self.rule_name, sudocmd=self.test_user) api.Command['sudorule_add_runasuser'](self.rule_name, user=self.test_user)
finally: finally:
api.Command['sudorule_mod'](self.rule_name, ipasudorunasusercategory=u'') api.Command['sudorule_mod'](self.rule_name, ipasudorunasusercategory=u'')