Imported Debian patch 4.7.2-3

This commit is contained in:
Timo Aaltonen
2019-05-06 08:43:34 +03:00
committed by Mario Fetka
parent 27edeba051
commit 8bc559c5a1
917 changed files with 1068993 additions and 1184676 deletions

View File

@@ -29,46 +29,31 @@ from ipatests.test_xmlrpc.tracker.host_plugin import HostTracker
from ipalib import errors
import pytest
renamedhostgroup1 = u'renamedhostgroup1'
@pytest.fixture(scope='class')
def hostgroup(request, xmlrpc_setup):
def hostgroup(request):
tracker = HostGroupTracker(name=u'hostgroup')
return tracker.make_fixture(request)
@pytest.fixture(scope='class')
def hostgroup_invalid(request, xmlrpc_setup):
def hostgroup_invalid(request):
tracker = HostGroupTracker(name=u'@invalid')
return tracker.make_fixture(request)
@pytest.fixture(scope='class')
def hostgroup_single(request, xmlrpc_setup):
def hostgroup_single(request):
tracker = HostGroupTracker(name=u'a')
return tracker.make_fixture(request)
@pytest.fixture(scope='class')
def host(request, xmlrpc_setup):
def host(request):
tracker = HostTracker(name=u'host')
return tracker.make_fixture(request)
@pytest.fixture(scope='class')
def ipaservers(request, xmlrpc_setup):
# Track the ipaservers hostgroup
# Since the hostgroup is protected, we cannot use 'make_fixture()' because
# it will try to delete the object when scope is destroyed and that will
# fail. Thus, we only create it here.
tracker = HostGroupTracker(
name=u'ipaservers', description=u'IPA server hosts'
)
tracker.exists = True
tracker.track_create()
return tracker
class TestNonexistentHostGroup(XMLRPC_test):
def test_retrieve_nonexistent(self, hostgroup):
""" Try to retrieve non-existent hostgroup """
@@ -120,35 +105,6 @@ class TestHostGroup(XMLRPC_test):
hostgroup.cn)):
command()
def test_rename_hostgroup(self, hostgroup):
""" Rename a hostgroup and than rename it back """
origname = hostgroup.cn
command = hostgroup.make_command(
'hostgroup_mod', *[hostgroup.cn],
**dict(setattr=u'cn=%s' % renamedhostgroup1))
result = command()
hostgroup.attrs.update(cn=[renamedhostgroup1])
hostgroup.check_update(result)
hostgroup.cn = renamedhostgroup1
command = hostgroup.make_command(
'hostgroup_mod', *[hostgroup.cn],
**dict(setattr=u'cn=%s' % origname))
result = command()
hostgroup.attrs.update(cn=[origname])
hostgroup.check_update(result)
hostgroup.cn = origname
def test_rename_ipaservers(self, ipaservers):
""" Try to rename the protected ipaservers group """
command = ipaservers.make_command('hostgroup_mod', *[ipaservers.cn],
**dict(rename=renamedhostgroup1))
reason = u'privileged hostgroup'
with raises_exact(errors.ProtectedEntryError(label=u'hostgroup',
key=ipaservers.cn, reason=reason)):
command()
def test_create_host_add_to_hostgroup(self, hostgroup, host):
""" Check that host can be added to hostgroup """
host.create()