mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-26 16:16:31 -06:00
Fix service_mod and add a test case
This commit is contained in:
parent
dacfddfdc8
commit
7a7041045e
@ -215,22 +215,21 @@ class service_mod(crud.Update):
|
||||
"""
|
||||
Modify service.
|
||||
"""
|
||||
def execute(self, principal, **kw):
|
||||
ldap = self.api.Backend.ldap
|
||||
def execute(self, principal, **options):
|
||||
ldap = self.api.Backend.ldap2
|
||||
# FIXME, should be in a normalizer. Need to fix normalizers to work
|
||||
# on non-unicode data.
|
||||
if kw.get('usercertificate'):
|
||||
kw['usercertificate'] = base64.b64decode(kw['usercertificate'])
|
||||
if options.get('usercertificate'):
|
||||
options['usercertificate'] = base64.b64decode(options['usercertificate'])
|
||||
|
||||
dn = ldap.make_dn(entry_attrs, 'krbprincipalname', _container_dn)
|
||||
entry_attrs = self.args_options_2_entry(*tuple(), **options)
|
||||
dn = ldap.make_dn_from_attr('krbprincipalname', principal, _container_dn)
|
||||
|
||||
(dn, old_entry_attrs) = ldap.get_entry(dn)
|
||||
if 'usercertificate' in old_entry_attrs and 'usercerficate' in kw:
|
||||
if 'usercertificate' in old_entry_attrs and 'usercerficate' in options:
|
||||
# FIXME, what to do here? Do we revoke the old cert?
|
||||
raise errors.GenericError(format='entry already has a certificate')
|
||||
|
||||
entry_attrs = self.args_options_to_entry(principal, **kw)
|
||||
|
||||
try:
|
||||
ldap.update_entry(dn, entry_attrs)
|
||||
except errors.EmptyModlist:
|
||||
|
@ -97,7 +97,17 @@ class test_service(XMLRPC_test):
|
||||
assert res
|
||||
assert_attr_equal(res[0][1], 'krbprincipalname', self.principal)
|
||||
|
||||
def test_7_service_del(self):
|
||||
def test_7_service_mod(self):
|
||||
"""
|
||||
Test the `xmlrpc.service_mod` method.
|
||||
"""
|
||||
modkw = self.kw
|
||||
modkw['usercertificate'] = 'QmluYXJ5IGNlcnRpZmljYXRl'
|
||||
(dn, res) = api.Command['service_mod'](**modkw)
|
||||
assert res
|
||||
assert_attr_equal(res, 'usercertificate', 'Binary certificate')
|
||||
|
||||
def test_8_service_del(self):
|
||||
"""
|
||||
Test the `xmlrpc.service_del` method.
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user