From c2af032c0333f7e210c54369159d1d9f5e3fec74 Mon Sep 17 00:00:00 2001 From: Martin Babinsky Date: Thu, 23 Jun 2016 18:54:49 +0200 Subject: Migrate management framework plugins to use Principal parameter All plugins will now use this parameter and common code for all operations on Kerberos principals. Additional semantic validators and normalizers were added to determine or append a correct realm so that the previous behavior is kept intact. https://fedorahosted.org/freeipa/ticket/3864 Reviewed-By: David Kupka Reviewed-By: Jan Cholasta --- ipatests/test_xmlrpc/test_host_plugin.py | 1 + ipatests/test_xmlrpc/test_service_plugin.py | 9 ++++++++- ipatests/test_xmlrpc/test_stageuser_plugin.py | 6 +++--- ipatests/test_xmlrpc/test_user_plugin.py | 5 +++-- 4 files changed, 15 insertions(+), 6 deletions(-) (limited to 'ipatests') diff --git a/ipatests/test_xmlrpc/test_host_plugin.py b/ipatests/test_xmlrpc/test_host_plugin.py index e6fc68a15..4ddabefff 100644 --- a/ipatests/test_xmlrpc/test_host_plugin.py +++ b/ipatests/test_xmlrpc/test_host_plugin.py @@ -357,6 +357,7 @@ class TestHostWithService(XMLRPC_test): result=dict( dn=service1dn, krbprincipalname=[service1], + krbcanonicalname=[service1], objectclass=objectclasses.service, managedby_host=[host.fqdn], ipauniqueid=[fuzzy_uuid], diff --git a/ipatests/test_xmlrpc/test_service_plugin.py b/ipatests/test_xmlrpc/test_service_plugin.py index 2e38b8d6b..69af06873 100644 --- a/ipatests/test_xmlrpc/test_service_plugin.py +++ b/ipatests/test_xmlrpc/test_service_plugin.py @@ -193,6 +193,7 @@ class test_service(Declarative): result=dict( dn=service1dn, krbprincipalname=[service1], + krbcanonicalname=[service1], objectclass=objectclasses.service, ipauniqueid=[fuzzy_uuid], managedby_host=[fqdn1], @@ -262,6 +263,7 @@ class test_service(Declarative): dict( dn=service1dn, krbprincipalname=[service1], + krbcanonicalname=service1, managedby_host=[fqdn1], has_keytab=False, ), @@ -281,6 +283,7 @@ class test_service(Declarative): dict( dn=service1dn, krbprincipalname=[service1], + krbcanonicalname=service1, has_keytab=False, ), ], @@ -619,7 +622,9 @@ class test_service(Declarative): dict( desc='Create service with malformed principal "foo"', command=('service_add', [u'foo'], {}), - expected=errors.MalformedServicePrincipal(reason='missing service') + expected=errors.ValidationError( + name='principal', + error='Service principal is required') ), @@ -715,6 +720,7 @@ class test_service_in_role(Declarative): result=dict( dn=service1dn, krbprincipalname=[service1], + krbcanonicalname=[service1], objectclass=objectclasses.service, ipauniqueid=[fuzzy_uuid], managedby_host=[fqdn1], @@ -919,6 +925,7 @@ class test_service_allowed_to(Declarative): result=dict( dn=service1dn, krbprincipalname=[service1], + krbcanonicalname=[service1], objectclass=objectclasses.service, ipauniqueid=[fuzzy_uuid], managedby_host=[fqdn1], diff --git a/ipatests/test_xmlrpc/test_stageuser_plugin.py b/ipatests/test_xmlrpc/test_stageuser_plugin.py index 96f7e22b3..34cfaf87a 100644 --- a/ipatests/test_xmlrpc/test_stageuser_plugin.py +++ b/ipatests/test_xmlrpc/test_stageuser_plugin.py @@ -345,9 +345,9 @@ class TestCreateInvalidAttributes(XMLRPC_test): stageduser.ensure_missing() command = stageduser.make_create_command( options={u'krbprincipalname': invalidrealm2}) - with raises_exact(errors.MalformedUserPrincipal( - message=u'Principal is not of the form user@REALM: \'%s\'' % - invalidrealm2)): + with raises_exact(errors.ConversionError( + name='principal', error="Malformed principal: '{}'".format( + invalidrealm2))): command() diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py index 6d58c53aa..8245dc7f0 100644 --- a/ipatests/test_xmlrpc/test_user_plugin.py +++ b/ipatests/test_xmlrpc/test_user_plugin.py @@ -806,8 +806,9 @@ class TestPrincipals(XMLRPC_test): ) command = testuser.make_create_command() - with raises_exact(errors.MalformedUserPrincipal( - principal=u'tuser1@BAD@NOTFOUND.ORG')): + with raises_exact(errors.ConversionError( + name='principal', error="Malformed principal: '{}'".format( + testuser.kwargs['krbprincipalname']))): command() def test_set_principal_expiration(self, user): -- cgit