def test_domain_admin_user_type(self):
        kolabWAPhelper = KolabWAPTestHelpers(self.driver)
        self.kolabWAPhelper = kolabWAPhelper
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("http://localhost/kolab-webadmin", "cn=Directory Manager", "test")

        kolabWAPhelper.select_domain("administrators.org")

        username, emailLogin, password = kolabWAPhelper.create_user(
            prefix = "admin")

        # now edit the user
        elem = self.driver.find_element_by_id("searchinput")
        elem.send_keys(username)
        elem.send_keys(Keys.RETURN)
        time.sleep(0.5)

        elem = self.driver.find_element_by_xpath("//tbody/tr/td[@class=\"name\"]")
        self.assertEquals(username + ", " + username, elem.text, "Expected to select user " + username + " but was " + elem.text)
        elem.click()
        time.sleep(0.5)
        
        # check if the user type is actually a domain admin
        elem = self.driver.find_element_by_xpath("//form[@id='user-form']/fieldset/table/tbody/tr/td[@class='value']")
        self.assertEquals("Domain Administrator", elem.text, "user type should be Domain Administrator, but was " + elem.text)

        kolabWAPhelper.logout_kolab_wap()
    def test_edit_user_himself(self):
        kolabWAPhelper = KolabWAPTestHelpers(self.driver)
        self.kolabWAPhelper = kolabWAPhelper
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("http://localhost/kolab-webadmin", "cn=Directory Manager", "test")

        username, emailLogin, password = kolabWAPhelper.create_user()

        kolabWAPhelper.logout_kolab_wap()

        # login the new user
        kolabWAPhelper.login_kolab_wap("http://localhost/kolab-webadmin", emailLogin, password)

        self.helper_user_edits_himself()
    def test_domain_admin(self):
        kolabWAPhelper = KolabWAPTestHelpers(self.driver)
        self.kolabWAPhelper = kolabWAPhelper
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("http://localhost/kolab-webadmin", "cn=Directory Manager", "test")

        kolabWAPhelper.select_domain("administrators.org")

        username, emailLogin, password = kolabWAPhelper.create_user(
            prefix = "admin",
            overall_quota = "1gb",
            default_quota = "100mb",
            max_accounts = 3,
            allow_groupware = True)

        # TODO create domain, with domain admin
        # TODO select domain
        # TODO create user accounts
        
        kolabWAPhelper.logout_kolab_wap()
    def test_modified_foldername_in_new_domain(self):
        kolabWAPhelper = KolabWAPTestHelpers(self.driver)
        self.kolabWAPhelper = kolabWAPhelper
        
        # login
        kolabWAPhelper.login_kolab_wap("http://localhost/kolab-webadmin", "cn=Directory Manager", "test")

        domainname = kolabWAPhelper.create_domain()

        #modify the default folders in /etc/kolab/kolab.conf
        newContactsFolderName = self.helper_modify_autocreate_folders()

        username, emailLogin, password = kolabWAPhelper.create_user()

        kolabWAPhelper.logout_kolab_wap()

        # check if mailbox has been created, with the modified folder name
        p = subprocess.Popen("kolab lm | grep " + username + " | grep " + newContactsFolderName, shell=True, stdout=subprocess.PIPE)
        out, err = p.communicate()
        if newContactsFolderName not in out:
            self.assertTrue(False, "kolab lm cannot find mailbox with folder " + newContactsFolderName + " for new user " + username)