From d4a1dc5712cd2fa9e028a43e5b7146891e5012f0 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 22 Feb 2012 17:42:38 -0500 Subject: Don't allow IPA master hosts or important services be deleted. Deleting these would cause the IPA master to blow up. For services I'm taking a conservative approach and only limiting the deletion of known services we care about. https://fedorahosted.org/freeipa/ticket/2425 --- tests/test_xmlrpc/test_host_plugin.py | 9 +++++++++ tests/test_xmlrpc/test_service_plugin.py | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'tests') diff --git a/tests/test_xmlrpc/test_host_plugin.py b/tests/test_xmlrpc/test_host_plugin.py index 372ee256..0323ac39 100644 --- a/tests/test_xmlrpc/test_host_plugin.py +++ b/tests/test_xmlrpc/test_host_plugin.py @@ -661,4 +661,13 @@ class test_host(Declarative): ), ), + + # This test will only succeed when running against lite-server.py + # on same box as IPA install. + dict( + desc='Delete the current host (master?) %s should be caught' % api.env.host, + command=('host_del', [api.env.host], {}), + expected=errors.ValidationError(name='fqdn', error='An IPA master host cannot be deleted'), + ), + ] diff --git a/tests/test_xmlrpc/test_service_plugin.py b/tests/test_xmlrpc/test_service_plugin.py index d36dac98..e97fb7c8 100644 --- a/tests/test_xmlrpc/test_service_plugin.py +++ b/tests/test_xmlrpc/test_service_plugin.py @@ -467,4 +467,21 @@ class test_service(Declarative): expected=errors.HostService() ), + + # These tests will only succeed when running against lite-server.py + # on same box as IPA install. + dict( + desc='Delete the current host (master?) %s HTTP service, should be caught' % api.env.host, + command=('service_del', ['HTTP/%s' % api.env.host], {}), + expected=errors.ValidationError(name='principal', error='This principal is required by the IPA master'), + ), + + + dict( + desc='Delete the current host (master?) %s ldap service, should be caught' % api.env.host, + command=('service_del', ['ldap/%s' % api.env.host], {}), + expected=errors.ValidationError(name='principal', error='This principal is required by the IPA master'), + ), + + ] -- cgit