#!/usr/share/ucs-test/runner python3
## desc: Create groups/group with the same name as an existing user
## tags: [udm]
## roles: [domaincontroller_master]
## exposure: careful
## packages:
##   - univention-config
##   - univention-directory-manager-tools

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

if __name__ == '__main__':
	with udm_test.UCSTestUDM() as udm:
		name = uts.random_name()

		user = udm.create_user(username=name)[0]

		try:
			group = udm.create_group(name=name)
		except udm_test.UCSTestUDM_CreateUDMObjectFailed:
			sys.exit(0)

		utils.fail('UDM did not report an error while trying to create a group with the name of an existing user')
