#!/usr/share/ucs-test/runner python3
## -*- coding: utf-8 -*-
## desc: check that isOxUser can be set in user template
## tags: [apptest]
## exposure: dangerous
## packages:
##   - univention-ox
## bugs: [50577]

import univention.testing.udm as testing_udm
import univention.testing.ucr as testing_ucr
import univention.testing.strings as uts


with testing_udm.UCSTestUDM() as udm, testing_ucr.UCSTestConfigRegistry() as ucr:
	print("*** Creating user template...")
	mail_domain = ucr["mail/hosteddomains"].split()[0]
	dn = udm.create_object(
		"settings/usertemplate",
		name=uts.random_username(),
		isOxUser="Not",
	)
	print("*** Modifying user template...")
	udm.modify_object(
		"settings/usertemplate",
		dn=dn,
		isOxUser="OK"
	)
	print("*** OK.")
