#!/usr/share/ucs-test/runner python3
## desc: Create dhcp/pool with wrong superordinate
## tags: [udm]
## roles: [domaincontroller_master]
## bugs: [13817, 31518]
## exposure: careful
## versions:
##  3.1-1: skip
##  4.1-4: fixed

import univention.testing.utils as utils
import univention.testing.udm as udm_test
import univention.testing.strings as uts


if __name__ == '__main__':
	with udm_test.UCSTestUDM() as udm:
		dhcpService = udm.create_object('dhcp/service', service=uts.random_string())
		try:
			udm.create_object('dhcp/pool', name=uts.random_string(), range='10.20.30.1 10.20.30.154', superordinate=dhcpService)
		except udm_test.UCSTestUDM_CreateUDMObjectFailed:
			pass
		else:
			utils.fail('UDM did not report an error while trying to create a dhcp/pool with DHCP service as superordinate')
