class KolabRoundcubeChangePassword(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def helper_user_change_password(self):
        driver = self.driver

        url = driver.current_url[:driver.current_url.find("?")]
        driver.get(url + "?_task=settings&_action=plugin.password")
        self.kolabWAPhelper.wait_loading(0.5)

        elem = driver.find_element_by_id("curpasswd")
        elem.send_keys("test")
        elem = driver.find_element_by_id("newpasswd")
        elem.send_keys("test1234")
        elem = driver.find_element_by_id("confpasswd")
        elem.send_keys("test1234")

        elem = driver.find_element_by_xpath("//form[@id=\"password-form\"]//input[@class=\"button mainaction\"]")
        elem.click()

        self.kolabWAPhelper.wait_loading()
        try:
            elem = driver.find_element_by_class_name("error")
            self.assertEquals("", elem.text, "User password was not changed: " + elem.text)            
        except NoSuchElementException, e:
            # no problem, usually there should not be an error
            elem = driver.find_element_by_class_name("confirmation")
            self.assertEquals("Successfully saved.", elem.text, "User password should have been successfully saved, but was: " + elem.text)
        
        self.kolabWAPhelper.log("User has updated his password successfully")
class KolabEmailSendAndReceiveEmail(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_send_and_receive_email(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_send_and_receive_email")
        
        # login Directory Manager, create 2 users
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")
        username1, emailLogin1, password1 = kolabWAPhelper.create_user()
        username2, emailLogin2, password2 = kolabWAPhelper.create_user()
        kolabWAPhelper.logout_kolab_wap()

        # login user1 to roundcube and send email
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin1, password1)
        emailSubjectLine = kolabWAPhelper.send_email(emailLogin2)
        kolabWAPhelper.logout_roundcube()
        kolabWAPhelper.wait_loading(5)

        # login user2 to roundcube and check for email
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin2, password2)
        kolabWAPhelper.check_email_received(emailSubjectLine=emailSubjectLine)
        kolabWAPhelper.logout_roundcube()

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.quit()
class KolabWAPDomainAdmin(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_domain_admin_default_quota(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_domain_admin")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        username, emailLogin, password = kolabWAPhelper.create_user(
            prefix = "admin",
            default_quota = "100mb",
            overall_quota = "300mb")

        # create domains, with domain admin
        domainname = kolabWAPhelper.create_domain(username)
        
        # create user accounts
        # test if default quota is set properly for a new user
        kolabWAPhelper.create_user(default_quota_verify = "100mb")
        kolabWAPhelper.create_user(mail_quota = "150mb")
        kolabWAPhelper.create_user(default_quota_verify = "100mb", expected_message_contains = "mailquota of the domain admin has been exceeded")

        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.quit()
class KolabEmailCatchAll(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_catch_all(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_catch_all")
        
        # login Directory Manager, create a domain and a user
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")
        domainname = kolabWAPhelper.create_domain()

        # add the user
        username, emailLogin, password = kolabWAPhelper.create_user(alias="@" + domainname)
        kolabWAPhelper.logout_kolab_wap()

        # send email to catch all alias address from command line
        print "sending email..."
        subject = 'subject ' + domainname
        subprocess.call(['/bin/bash', '-c', 'echo "test" | mail -s "' + subject + '" alias' + domainname + '@' + domainname])
        kolabWAPhelper.wait_loading(2.0)

        # login user to roundcube and check for email
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin, password)
        kolabWAPhelper.check_email_received(subject)
        kolabWAPhelper.logout_roundcube()

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.close()
class KolabAutoCreateFolders(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def helper_modify_autocreate_folders(self):
        # read kolab.conf
        fo = open("/etc/kolab/kolab.conf", "r+")
        content = fo.read()
        fo.close()
        
        newContactsFolderName = "Contacts" + datetime.datetime.now().strftime("%H%M%S")

        # find [kolab], find line starting with 'Contacts, replace with 'Contacts125559': {
        pos = content.index("[kolab]")
        pos = content.index("'Contacts", pos)
        posAfter = content.index(": {", pos)
        
        content = content[:pos] + "'" + newContactsFolderName + "'" + content[posAfter:]
        
        # write kolab.conf
        fo = open("/etc/kolab/kolab.conf", "wb")
        fo.write(content)
        fo.close()
        
        self.kolabWAPhelper.log("kolab.conf has been changed, autocreate_folders now contains " + newContactsFolderName)
        
        return newContactsFolderName

    def test_modified_foldername_in_new_domain(self):

        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log ("Running test: test_modified_foldername_in_new_domain")
        
        # login
        kolabWAPhelper.login_kolab_wap("/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)

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.close()
Exemplo n.º 6
0
class KolabWAPLastLogin(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_last_login(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_last_login")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        username, emailLogin, password = kolabWAPhelper.create_user()
        kolabWAPhelper.logout_kolab_wap()

        # login the new user
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin, password)
        kolabWAPhelper.logout_roundcube()

        # check that the last login timestamp is greater than 1 January 2014
        value = kolabWAPhelper.getLDAPValue(
            "uid=" + username + ",ou=People," + kolabWAPhelper.getConf("ldap", "base_dn"), "tbitsKolabLastLogin"
        )
        self.assertTrue(int(value) > 1388534400, "login date should be after 1 January 2014")

        # last login time will only be updated after an hour, so we cannot test that here. see pykolab/auth/ldap/auth_cache.py purge_entries

    def test_last_login_in_other_domain(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_last_login")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        domainname = kolabWAPhelper.create_domain()

        username, emailLogin, password = kolabWAPhelper.create_user()
        kolabWAPhelper.logout_kolab_wap()

        # login the new user
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin, password)
        kolabWAPhelper.logout_roundcube()

        # check that the last login timestamp is greater than 1 January 2014
        value = kolabWAPhelper.getLDAPValue(
            "uid=" + username + ",ou=People,dc=" + ",dc=".join(domainname.split(".")), "tbitsKolabLastLogin"
        )
        self.assertTrue(int(value) > 1388534400, "login date should be after 1 January 2014")

        # last login time will only be updated after an hour, so we cannot test that here. see pykolab/auth/ldap/auth_cache.py purge_entries

    def tearDown(self):

        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()

        self.driver.quit()
class KolabWAPDomainAdmin(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_enabled_groupware_features(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_enabled_groupware_features")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        kolabWAPhelper.select_domain("administrators.org")

        username, emailLogin, password = kolabWAPhelper.create_user(
            prefix = "admin")
            # enabled by default: allow_groupware = True

        # create domains, with domain admin
        domainname = kolabWAPhelper.create_domain(username)
        
        # create user account. role enable-groupware-features should be set by default
        kolabWAPhelper.create_user(default_role_verify = "enable-groupware-features")

        kolabWAPhelper.logout_kolab_wap()

    def test_disabled_groupware_features(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_disabled_groupware_features")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        kolabWAPhelper.select_domain("administrators.org")

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

        # create domains, with domain admin
        domainname = kolabWAPhelper.create_domain(username)
        
        # create user account. role enable-groupware-features should not be set
        kolabWAPhelper.create_user(default_role_verify = "")

        # TODO: create role enable-groupware-features for the domain
        # TODO: create a new user with role enable-groupware-features, should fail!

        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.close()
class KolabEmailCatchAllAcrossDomains(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_catch_all_across_domains(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_catch_all_across_domains")

        # login Directory Manager, create a domain and a user
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")
        # important: alias domain must be set in the domain names, otherwise: email address not in local domain
        domainname = kolabWAPhelper.create_domain(withAliasDomain=True)
        aliasdomainname = string.replace(domainname, "domain", "alias")

        username = "******" + datetime.datetime.now().strftime("%Y%m%d%H%M%S")
        # what happens if we have not added the alias domain yet to postfix config?
        kolabWAPhelper.create_user(username=username,
                                   alias="@" + aliasdomainname,
                                   expected_message_contains="Alias '@" +
                                   aliasdomainname +
                                   "' must be configured manually")

        # add alias domain, and call postmap
        postfixfile = "/etc/postfix/virtual_alias_maps_manual.cf"
        subprocess.call([
            '/bin/bash', '-c', 'echo "@' + aliasdomainname + ' ' + username +
            '.' + username + '@' + domainname + '" >> ' + postfixfile
        ])
        subprocess.call(['postmap', postfixfile])
        subprocess.call(['service', 'postfix', 'restart'])

        # now add user for real
        username, emailLogin, password = kolabWAPhelper.create_user(
            username=username, alias="@" + aliasdomainname)
        kolabWAPhelper.logout_kolab_wap()

        # send email to catch all alias address from command line
        print "sending email..."
        subprocess.call([
            '/bin/bash', '-c', 'echo "test" | mail -s "subject ' +
            aliasdomainname + '" test@' + aliasdomainname
        ])
        kolabWAPhelper.wait_loading(2.0)

        # login user to roundcube and check for email
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin, password)
        kolabWAPhelper.check_email_received("subject " + aliasdomainname)
        kolabWAPhelper.logout_roundcube()

    def tearDown(self):

        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()

        self.driver.close()
Exemplo n.º 9
0
class KolabEmailSharedFolders(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_shared_folder(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_send_and_receive_email")

        # login Directory Manager, create 2 users
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")
        username1, emailLogin1, password1 = kolabWAPhelper.create_user()
        #username2, emailLogin2, password2 = kolabWAPhelper.create_user()

        # create shared folder
        # could use delegates=[emailLogin1, emailLogin2], but this is not tested at the moment
        emailSharedFolder, foldername = kolabWAPhelper.create_shared_folder()
        kolabWAPhelper.logout_kolab_wap()

        # need to give everyone permission to send to this folder
        subprocess.call([
            '/bin/bash', '-c',
            "kolab sam shared/" + emailSharedFolder + " anyone lrsp"
        ])
        kolabWAPhelper.wait_loading(2.0)

        # login user to roundcube to send and check for email
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin1,
                                       password1)

        # TODO: why can I see and subscribe to all folders in the domain?
        # can we set permissions who can read the folder? Recipient Access list?
        # solution: http://lists.kolab.org/pipermail/users/2013-December/016161.html
        #           quote: Shared folders are created with the ACL "anyone lrs" (anyone read) per default.
        #                  After creating them you'll likely adjust the ACLs based on your needs.

        print "sending email to " + emailSharedFolder
        emailSubjectLine = kolabWAPhelper.send_email(emailSharedFolder)
        kolabWAPhelper.wait_loading(3.0)
        kolabWAPhelper.check_email_received(
            emailSubjectLineDoesNotContain="Undelivered Mail Returned to Sender"
        )
        # no need to subscribe the folder, because we are using the direct url to load the folder in Roundcube
        kolabWAPhelper.check_email_received(
            folder="Shared+Folders%2Fshared%2F" + foldername,
            emailSubjectLine=emailSubjectLine)
        kolabWAPhelper.logout_roundcube()

    def tearDown(self):

        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()

        self.driver.close()
Exemplo n.º 10
0
class KolabWAPLastLogin(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_last_login(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_last_login")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        username, emailLogin, password, uid = kolabWAPhelper.create_user()
        kolabWAPhelper.logout_kolab_wap()

        # login the new user
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin, password)
        kolabWAPhelper.logout_roundcube()

        # check that the last login timestamp is greater than 1 January 2014
        value = kolabWAPhelper.getLDAPValue("uid="+username+",ou=People," + kolabWAPhelper.getConf('ldap', 'base_dn'), 'tbitsKolabLastLogin')
        self.assertTrue(int(value) > 1388534400, "login date should be after 1 January 2014")

        # last login time will only be updated after an hour, so we cannot test that here. see pykolab/auth/ldap/auth_cache.py purge_entries

    def test_last_login_in_other_domain(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_last_login_in_other_domain")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        domainname = kolabWAPhelper.create_domain()

        username, emailLogin, password, uid = kolabWAPhelper.create_user()
        kolabWAPhelper.logout_kolab_wap()

        # login the new user
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin, password)
        kolabWAPhelper.logout_roundcube()

        # check that the last login timestamp is greater than 1 January 2014
        value = kolabWAPhelper.getLDAPValue("uid="+username+",ou=People,dc=" + ",dc=".join(domainname.split(".")), 'tbitsKolabLastLogin')
        self.assertTrue(int(value) > 1388534400, "login date should be after 1 January 2014")

        # last login time will only be updated after an hour, so we cannot test that here. see pykolab/auth/ldap/auth_cache.py purge_entries

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.quit()
Exemplo n.º 11
0
class KolabEmailSharedFolders(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_shared_folder(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_shared_folder")
        
        # login Directory Manager, create 2 users
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")
        username1, emailLogin1, password1 = kolabWAPhelper.create_user()
        #username2, emailLogin2, password2 = kolabWAPhelper.create_user()

        # create shared folder
        # could use delegates=[emailLogin1, emailLogin2], but this is not tested at the moment
        emailSharedFolder, foldername = kolabWAPhelper.create_shared_folder()
        kolabWAPhelper.logout_kolab_wap()
        
        # need to give everyone permission to send to this folder
        # need to wait some seconds, otherwise the permissions will be reset to lrs, probably by kolabd???
        kolabWAPhelper.wait_loading(20.0)
        subprocess.call(['/bin/bash', '-c', "kolab sam shared/" + emailSharedFolder + " anyone full"])
        kolabWAPhelper.wait_loading(20.0)
        subprocess.call(['/bin/bash', '-c', "kolab lam shared/" + emailSharedFolder])

        # login user to roundcube to send and check for email
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin1, password1)
        
        # TODO: why can I see and subscribe to all folders in the domain?
        # can we set permissions who can read the folder? Recipient Access list?
        # solution: http://lists.kolab.org/pipermail/users/2013-December/016161.html
        #           quote: Shared folders are created with the ACL "anyone lrs" (anyone read) per default.  
        #                  After creating them you'll likely adjust the ACLs based on your needs.
        
        print "sending email to " + emailSharedFolder
        emailSubjectLine = kolabWAPhelper.send_email(emailSharedFolder)
        kolabWAPhelper.wait_loading(3.0)
        kolabWAPhelper.check_email_received(emailSubjectLineDoesNotContain="Undelivered Mail Returned to Sender")
        # no need to subscribe the folder, because we are using the direct url to load the folder in Roundcube
        kolabWAPhelper.check_email_received(
                        folder="Shared+Folders%2Fshared%2F"+foldername, 
                        emailSubjectLine=emailSubjectLine)
        kolabWAPhelper.logout_roundcube()

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.quit()
    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()
class KolabEmailCatchAllAcrossDomains(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_catch_all_across_domains(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_catch_all_across_domains")
        
        # login Directory Manager, create a domain and a user
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")
        # important: alias domain must be set in the domain names, otherwise: email address not in local domain
        domainname = kolabWAPhelper.create_domain(withAliasDomain=True)
        aliasdomainname = string.replace(domainname, "domain", "alias")

        username = "******" + datetime.datetime.now().strftime("%Y%m%d%H%M%S")
        # what happens if we have not added the alias domain yet to postfix config?
        kolabWAPhelper.create_user(
            username=username,
            alias="catchall@" + aliasdomainname,
            expected_message_contains="Alias 'catchall@" + aliasdomainname +"' must be configured manually")

        # add alias domain, and call postmap
        postfixfile="/etc/postfix/virtual_alias_maps_manual.cf"
        subprocess.call(['/bin/bash', '-c', 'echo "@' + aliasdomainname + ' ' + username + '.' + username +'@' + domainname + '" >> ' + postfixfile])
        subprocess.call(['postmap', postfixfile])
        subprocess.call(['service', 'postfix', 'restart'])
        
        # now add user for real
        username, emailLogin, password = kolabWAPhelper.create_user(username=username, alias="catchall@" + aliasdomainname)
        kolabWAPhelper.logout_kolab_wap()

        # send email to catch all alias address from command line
        print "sending email..."
        subprocess.call(['/bin/bash', '-c', 'echo "test" | mail -s "subject ' + aliasdomainname + '" test@' + aliasdomainname])
        kolabWAPhelper.wait_loading(10.0)

        # login user to roundcube and check for email
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin, password)
        kolabWAPhelper.check_email_received(emailSubjectLine="subject " + aliasdomainname)
        kolabWAPhelper.logout_roundcube()

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.quit()
class KolabWAPDomainAdmin(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_max_accounts(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_max_accounts")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin(
            max_accounts = 3)

        # create another domain, with domain admin
        domainname2 = kolabWAPhelper.create_domain(username)

        # create user accounts
        kolabWAPhelper.select_domain(domainname)
        kolabWAPhelper.create_user()
        kolabWAPhelper.create_user()
        kolabWAPhelper.select_domain(domainname2)
        username2, emailLogin2, password2, uid2 = kolabWAPhelper.create_user()
        # should fail, only 3 accounts allowed, excluding the domain admin
        kolabWAPhelper.create_user(expected_message_contains = "Cannot create another account")

        # create another domain admin, for the same domains, but with higher max_accounts
        username2, emailLogin2, password2, uid2 = kolabWAPhelper.create_domainadmin(
            max_accounts = 7)
        kolabWAPhelper.link_admin_to_domain(username2, domainname)
        # should still fail, because only one admin can have a max account number
        kolabWAPhelper.select_domain(domainname)
        kolabWAPhelper.create_user(expected_message_contains =
            "only one domainadmin can have a maximum account number specified")

        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.quit()
Exemplo n.º 15
0
class KolabEmailCatchAll(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_catch_all(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_catch_all")
        
        # login Directory Manager, create a domain and a user
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")
        domainname = kolabWAPhelper.create_domain()

        # add the user
        username, emailLogin, password, uid = kolabWAPhelper.create_user(alias="catchall@" + domainname)

        # add another user with an email address that should be excluded from catchall
        username2, emailLogin2, password2, uid2 = kolabWAPhelper.create_user()

        kolabWAPhelper.logout_kolab_wap()

        # send email to catch all alias address from command line
        print "sending email..."
        subject = 'subject ' + domainname
        subprocess.call(['/bin/bash', '-c', 'echo "test" | mail -s "' + subject + '" alias' + domainname + '@' + domainname])

        # send email to the other user from the command line
        subject2 = 'subject ' + username2
        subprocess.call(['/bin/bash', '-c', 'echo "test" | mail -s "' + subject2 + '" ' + emailLogin2])
 
        kolabWAPhelper.wait_loading(2.0)

        # login catchall user to roundcube and check for email
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin, password)
        kolabWAPhelper.check_email_received(emailSubjectLine=subject)
        kolabWAPhelper.logout_roundcube()

        # login other user to roundcube and check for email
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin2, password2)
        kolabWAPhelper.check_email_received(emailSubjectLine=subject2)
        kolabWAPhelper.logout_roundcube()

    def tearDown(self):
        self.kolabWAPhelper.tear_down()
class KolabWAPDomainAdmin(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_max_accounts(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_max_accounts")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin(
            max_accounts = 4)

        # create another domain, with domain admin
        domainname2 = kolabWAPhelper.create_domain(username)

        # create user accounts
        kolabWAPhelper.select_domain(domainname)
        kolabWAPhelper.create_user()
        kolabWAPhelper.create_user()
        kolabWAPhelper.select_domain(domainname2)
        username2, emailLogin2, password2 = kolabWAPhelper.create_user()
        # should fail, only 4 accounts allowed, including the domain admin
        kolabWAPhelper.create_user(expected_message_contains = "Cannot create another account")

        kolabWAPhelper.upgrade_user_to_domainadmin(username2, domainname, max_accounts = 7)
        # should still fail, because the minimum is used
        kolabWAPhelper.create_user(expected_message_contains = "Cannot create another account")

        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.quit()
Exemplo n.º 17
0
class KolabWAPDomainAdmin(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_max_accounts(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_max_accounts")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        kolabWAPhelper.select_domain("administrators.org")

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

        # create domains, with domain admin
        domainname = kolabWAPhelper.create_domain(username)
        domainname2 = kolabWAPhelper.create_domain(username)

        # create user accounts
        kolabWAPhelper.select_domain(domainname)
        kolabWAPhelper.create_user()
        kolabWAPhelper.create_user()
        kolabWAPhelper.select_domain(domainname2)
        kolabWAPhelper.create_user()
        # should fail, only 3 accounts allowed
        kolabWAPhelper.create_user(
            expected_message_contains="Cannot create another account")

        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):

        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()

        self.driver.close()
class KolabWAPDomainAdmin(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_max_accounts(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_max_accounts")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        kolabWAPhelper.select_domain("administrators.org")

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

        # create domains, with domain admin
        domainname = kolabWAPhelper.create_domain(username)
        domainname2 = kolabWAPhelper.create_domain(username)
        
        # create user accounts
        kolabWAPhelper.select_domain(domainname)
        kolabWAPhelper.create_user()
        kolabWAPhelper.create_user()
        kolabWAPhelper.select_domain(domainname2)
        kolabWAPhelper.create_user()
        # should fail, only 3 accounts allowed
        kolabWAPhelper.create_user(expected_message_contains = "Cannot create another account")

        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.close()
class KolabEmailCatchAll(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_catch_all(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_catch_all")

        # login Directory Manager, create a domain and a user
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")
        domainname = kolabWAPhelper.create_domain()

        # add the user
        username, emailLogin, password = kolabWAPhelper.create_user(alias="@" +
                                                                    domainname)
        kolabWAPhelper.logout_kolab_wap()

        # send email to catch all alias address from command line
        print "sending email..."
        subject = 'subject ' + domainname
        subprocess.call([
            '/bin/bash', '-c', 'echo "test" | mail -s "' + subject +
            '" alias' + domainname + '@' + domainname
        ])
        kolabWAPhelper.wait_loading(2.0)

        # login user to roundcube and check for email
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin, password)
        kolabWAPhelper.check_email_received(subject)
        kolabWAPhelper.logout_roundcube()

    def tearDown(self):

        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()

        self.driver.close()
    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()
class KolabWAPDomainAdmin(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_domain_admin_default_quota(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_domain_admin")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        kolabWAPhelper.select_domain("administrators.org")

        username, emailLogin, password = kolabWAPhelper.create_user(
            prefix="admin", default_quota="100mb", overall_quota="300mb")

        # create domains, with domain admin
        domainname = kolabWAPhelper.create_domain(username)

        # create user accounts
        # test if default quota is set properly for a new user
        kolabWAPhelper.create_user(default_quota_verify="100mb")
        kolabWAPhelper.create_user(mail_quota="150mb")
        kolabWAPhelper.create_user(
            default_quota_verify="100mb",
            expected_message_contains=
            "mailquota of the domain admin has been exceeded")

        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):

        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()

        self.driver.close()
Exemplo n.º 22
0
class KolabRoundcubeChangePassword(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def helper_user_change_password(self):
        driver = self.driver

        url = driver.current_url[:driver.current_url.find("?")]
        driver.get(url + "?_task=settings&_action=plugin.password")
        self.kolabWAPhelper.wait_loading(0.5)

        elem = driver.find_element_by_id("curpasswd")
        elem.send_keys("test")
        elem = driver.find_element_by_id("newpasswd")
        elem.send_keys("test1234")
        elem = driver.find_element_by_id("confpasswd")
        elem.send_keys("test1234")

        elem = driver.find_element_by_xpath(
            "//form[@id=\"password-form\"]//input[@class=\"button mainaction\"]"
        )
        elem.click()

        self.kolabWAPhelper.wait_loading()
        try:
            elem = driver.find_element_by_class_name("error")
            self.assertEquals("", elem.text,
                              "User password was not changed: " + elem.text)
        except NoSuchElementException, e:
            # no problem, usually there should not be an error
            elem = driver.find_element_by_class_name("confirmation")
            self.assertEquals(
                "Successfully saved.", elem.text,
                "User password should have been successfully saved, but was: "
                + elem.text)

        self.kolabWAPhelper.log("User has updated his password successfully")
    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)
class KolabWAPDomainAdmin(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    # test if correct user type is used in a normal domain
    def test_default_user_type_in_normal_domain(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_default_user_type_in_normal_domain")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

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

        # now edit the user
        elem = self.driver.find_element_by_id("searchinput")
        elem.send_keys(username)
        elem.send_keys(Keys.ENTER)
        kolabWAPhelper.wait_loading(initialwait = 2)

        elem = self.driver.find_element_by_xpath("//table[@id='userlist']/tbody/tr/td")
        self.assertEquals(username + ", " + username, elem.text, "Expected to select user " + username + " but was " + elem.text)
        elem.click()

        kolabWAPhelper.wait_loading(initialwait = 1)

        # check if the user type is actually a normal kolab user
        elem = self.driver.find_element_by_xpath("//form[@id='user-form']/fieldset/table/tbody/tr/td[@class='value']")
        self.assertEquals("Kolab User", elem.text, "user type should be Kolab User, but was " + elem.text)

        kolabWAPhelper.logout_kolab_wap()

    # test if correct user type is used when not many attributes are set which are specific for domain admins
    def test_domain_admin_user_type(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_domain_admin_user_type")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/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.ENTER)
        kolabWAPhelper.wait_loading(initialwait = 2)

        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()
        
        kolabWAPhelper.wait_loading(initialwait = 1)

        # 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 tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.close()
Exemplo n.º 26
0
class KolabAutoCreateFolders(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def helper_modify_autocreate_folders(self):
        # read kolab.conf
        fo = open("/etc/kolab/kolab.conf", "r+")
        content = fo.read()
        fo.close()
        
        newContactsFolderName = "Contacts" + datetime.datetime.now().strftime("%H%M%S")

        # find [kolab], find line starting with 'Contacts, replace with 'Contacts125559': {
        pos = content.index("[kolab]")
        pos = content.index("'Contacts", pos)
        posAfter = content.index(": {", pos)
        
        content = content[:pos] + "'" + newContactsFolderName + "'" + content[posAfter:]
        
        # write kolab.conf
        fo = open("/etc/kolab/kolab.conf", "wb")
        fo.write(content)
        fo.close()

        # restart kolabd to pickup the changed kolab.conf file
        self.kolabWAPhelper.startKolabServer("restart")
        
        self.kolabWAPhelper.log("kolab.conf has been changed, autocreate_folders now contains " + newContactsFolderName)
        
        return newContactsFolderName

    def test_modified_foldername(self):

        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log ("Running test: test_modified_foldername")
        
        # login
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        #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
        out = ""
        starttime=datetime.datetime.now()
        while newContactsFolderName not in out and (datetime.datetime.now()-starttime).seconds < 60:
           kolabWAPhelper.wait_loading(1)
           p = subprocess.Popen("kolab list-mailboxes | grep " + username, 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)

    def test_modified_foldername_in_new_domain(self):

        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log ("Running test: test_modified_foldername_in_new_domain")
        
        # login
        kolabWAPhelper.login_kolab_wap("/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
        out = ""
        starttime=datetime.datetime.now()
        while newContactsFolderName not in out and (datetime.datetime.now()-starttime).seconds < 60:
           kolabWAPhelper.wait_loading(1)
           p = subprocess.Popen("kolab list-mailboxes | grep " + username, 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)

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.quit()
Exemplo n.º 27
0
class KolabWAPDomainAdmin(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    # check that domain admin cannot assign too much quota to the user accounts
    def test_overall_quota_limit(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_overall_quota_limit")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        username, emailLogin, password, uid = kolabWAPhelper.create_user(
            prefix="admin", overall_quota="800mb")

        # create domains, with domain admin
        domainname = kolabWAPhelper.create_domain(username)
        domainname2 = kolabWAPhelper.create_domain(username)

        # create user accounts
        kolabWAPhelper.select_domain(domainname)
        # test if no account has been created yet, validation will still kick in
        kolabWAPhelper.create_user(
            mail_quota="2gb",
            expected_message_contains=
            "mailquota of the domain admin has been exceeded")
        kolabWAPhelper.create_user(mail_quota="200mb")
        kolabWAPhelper.select_domain(domainname2)
        # should fail, exceeding the overall quota of the domain admin
        kolabWAPhelper.create_user(
            mail_quota="900mb",
            expected_message_contains=
            "mailquota of the domain admin has been exceeded")
        kolabWAPhelper.create_user(mail_quota="600mb")

        kolabWAPhelper.logout_kolab_wap()

    # test that a domain admin with a mail quota cannot create user mailboxes with no quota specified
    def test_unlimited_user_quota(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_unlimited_user_quota")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        username, emailLogin, password, uid = kolabWAPhelper.create_user(
            prefix="admin", overall_quota="1gb")

        # create domain, with domain admin
        domainname = kolabWAPhelper.create_domain(username)

        # create user account
        kolabWAPhelper.create_user(
            expected_message_contains="must specify a mailquota for the user")

        kolabWAPhelper.logout_kolab_wap()

    # test that a domain admin with no mail quota can create user mailboxes with as much quota as he wants
    def test_no_quota(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_no_quota")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

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

        # create domain, with domain admin
        domainname = kolabWAPhelper.create_domain(username)

        # create user account with a quota
        kolabWAPhelper.create_user(mail_quota="100mb")
        # without any quota for the user
        kolabWAPhelper.create_user()

        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):

        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()

        self.driver.quit()
Exemplo n.º 28
0
class KolabWAPDomainAdmin(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    # test if correct user type is used in a normal domain
    def test_default_user_type_in_normal_domain(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log(
            "Running test: test_default_user_type_in_normal_domain")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

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

        # now edit the user
        kolabWAPhelper.load_user(username)

        # check if the user type is actually a normal kolab user
        elem = self.driver.find_element_by_xpath(
            "//form[@id='user-form']/fieldset/table/tbody/tr/td[@class='value']"
        )
        self.assertEquals(
            "Kolab User", elem.text,
            "user type should be Kolab User, but was " + elem.text)

        kolabWAPhelper.logout_kolab_wap()

    def test_domain_admin_with_own_domain(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_domain_admin_with_own_domain")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin(
        )

        # now edit the user
        self.driver.get(self.driver.current_url)
        elem = self.driver.find_element_by_link_text("Users")
        elem.click()
        kolabWAPhelper.wait_loading()
        elem = self.driver.find_element_by_id("searchinput")
        elem.send_keys(username)
        elem.send_keys(Keys.ENTER)
        kolabWAPhelper.wait_loading(initialwait=2)

        elem = self.driver.find_element_by_xpath(
            "//table[@id='userlist']/tbody/tr/td")
        self.assertEquals(
            username + ", " + username, elem.text,
            "Expected to select user " + username + " but was " + elem.text)
        elem.click()

        kolabWAPhelper.wait_loading(initialwait=1)

        # check if the user type is a Kolab user with domain admin permissions
        elem = self.driver.find_element_by_xpath(
            "//form[@id='user-form']/fieldset/table/tbody/tr/td[@class='value']"
        )
        self.assertEquals(
            "Kolab User", elem.text,
            "user type should be Kolab user, but was " + elem.text)
        elem = self.driver.find_element_by_link_text("Domain Administrator")
        elem.click()
        if not self.driver.find_element_by_xpath(
                "//input[@name='tbitskolabisdomainadmin']").is_selected():
            self.assertTrue(False, "isDomainAdmin should be checked")

        kolabWAPhelper.logout_kolab_wap()

    # test that domain admin cannot edit its own maxaccount / overallquota
    def test_domain_admin_edit_own_parameters(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log(
            "Running test: test_domain_admin_edit_own_parameters")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin(
        )
        kolabWAPhelper.logout_kolab_wap()

        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", emailLogin, password)
        elem = self.driver.find_element_by_xpath("//div[@class=\"settings\"]")
        elem.click()
        self.kolabWAPhelper.wait_loading()
        elem = self.driver.find_element_by_link_text("Domain Administrator")
        elem.click()
        self.kolabWAPhelper.wait_loading()
        # the domain admin should not be able to edit his own parameters, eg max accounts
        elem = self.driver.find_element_by_xpath(
            "//input[@name=\"tbitskolabmaxaccounts\"]")
        if not "readonly" in elem.get_attribute('class'):
            self.assertTrue(
                False, "maxaccounts should be readonly for the domain admin")
        # also not tbitskolaboverallquota
        elem = self.driver.find_element_by_xpath(
            "//input[@name=\"tbitskolaboverallquota\"]")
        if not "readonly" in elem.get_attribute('class'):
            self.assertTrue(
                False, "overallquota should be readonly for the domain admin")
        # and the checkbox for domainadmin itself should be readonly and disabled
        elem = self.driver.find_element_by_xpath(
            "//input[@name=\"tbitskolabisdomainadmin\"]")
        if not "readonly" in elem.get_attribute('class'):
            self.assertTrue(
                False, "isdomainadmin should be readonly for the domain admin")
        if not elem.get_attribute('disabled') == 'true':
            self.assertTrue(
                False, "isdomainadmin should be disabled for the domain admin")

        kolabWAPhelper.logout_kolab_wap()

    # test if the domain admin can add users to his domain
    def test_domain_admin_create_user(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_domain_admin_edit_create_user")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin(
        )
        kolabWAPhelper.logout_kolab_wap()

        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", emailLogin, password)
        # check selected domain is correct
        currentdomain = kolabWAPhelper.get_selected_domain()
        self.assertEquals(domainname, currentdomain,
                          "should have selected domain " + domainname)
        kolabWAPhelper.create_user()
        kolabWAPhelper.logout_kolab_wap()

    # test if ex-domain admin cannot add users
    def test_ex_domain_admin_without_permission(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log(
            "Running test: test_ex_domain_admin_without_permission")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin(
        )

        # now withdraw domainadmin permissions
        kolabWAPhelper.load_user(username)
        self.driver.find_element_by_link_text("Domain Administrator").click()
        self.driver.find_element_by_xpath(
            "//input[@name='tbitskolabisdomainadmin']").click()
        self.driver.find_element_by_xpath("//input[@value=\"Submit\"]").click()

        kolabWAPhelper.logout_kolab_wap()

        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", emailLogin, password)
        # check selected domain is correct
        currentdomain = kolabWAPhelper.get_selected_domain()
        self.assertEquals(domainname, currentdomain,
                          "should have selected domain " + domainname)

        self.driver.find_element_by_link_text("Users").click()
        kolabWAPhelper.wait_loading()

        didFail = True
        try:
            elem = self.driver.find_element_by_xpath(
                "//span[@class=\"formtitle\"]")
            didFail = False
        except:
            # all is fine, there should not be a Add User title, but an empty box
            pass

        if not didFail:
            self.assertTrue(
                False,
                "ex-domain admin should not be able to create new accounts")

        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):

        self.kolabWAPhelper.tear_down()

        self.driver.quit()
Exemplo n.º 29
0
class KolabWAPDomainAdmin(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    # test if correct user type is used in a normal domain
    def test_default_user_type_in_normal_domain(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log(
            "Running test: test_default_user_type_in_normal_domain")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

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

        # now edit the user
        kolabWAPhelper.load_user(username)

        # check if the user type is actually a normal kolab user
        elem = self.driver.find_element_by_xpath(
            "//form[@id='user-form']/fieldset/table/tbody/tr/td[@class='value']"
        )
        self.assertEquals(
            "Kolab User", elem.text,
            "user type should be Kolab User, but was " + elem.text)

        kolabWAPhelper.logout_kolab_wap()

    def test_domain_admin_with_own_domain(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_domain_admin_with_own_domain")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin(
        )

        # some tests if the domain admin has been stored in LDAP as expected
        # there should not be the objectClass: mailrecipient
        # there should not be mail: or alias:
        ldapuid = "uid=" + username + ",ou=People,dc=" + ",dc=".join(
            domainname.split("."))
        value = kolabWAPhelper.getLDAPValue(ldapuid, 'objectClass')
        if 'mailrecipient' in value:
            self.assertIsNone(
                value,
                "we don't want objectClass mailrecipient for domainadmins but there is "
                + str(value))
        value = kolabWAPhelper.getLDAPValue(ldapuid, 'mail', '*')
        self.assertIsNone(
            value,
            "we don't want an attribute mail for domainadmins but there is " +
            str(value))
        value = kolabWAPhelper.getLDAPValue(ldapuid, 'alias', '*')
        self.assertIsNone(
            value,
            "we don't want an attribute alias for domainadmins but there is " +
            str(value))

        # now edit the user
        self.driver.get(self.driver.current_url)
        elem = self.driver.find_element_by_link_text("Users")
        elem.click()
        kolabWAPhelper.wait_loading()
        elem = self.driver.find_element_by_id("searchinput")
        elem.send_keys(username)
        elem.send_keys(Keys.ENTER)
        kolabWAPhelper.wait_loading(initialwait=2)

        elem = self.driver.find_element_by_xpath(
            "//table[@id='userlist']/tbody/tr/td")
        self.assertEquals(
            username + ", " + username, elem.text,
            "Expected to select user " + username + " but was " + elem.text)
        elem.click()

        kolabWAPhelper.wait_loading(initialwait=1)

        # check if the user type is a Kolab Domain Administrator
        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()

    # test that domain admin cannot edit its own maxaccount / overallquota
    def test_domain_admin_edit_own_parameters(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log(
            "Running test: test_domain_admin_edit_own_parameters")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin(
        )
        kolabWAPhelper.logout_kolab_wap()

        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", emailLogin, password)
        elem = self.driver.find_element_by_xpath("//div[@class=\"settings\"]")
        elem.click()
        self.kolabWAPhelper.wait_loading()
        elem = self.driver.find_element_by_link_text("Domain Administrator")
        elem.click()
        self.kolabWAPhelper.wait_loading()
        # the domain admin should not be able to edit his own parameters, eg max accounts
        elem = self.driver.find_element_by_xpath(
            "//input[@name=\"tbitskolabmaxaccounts\"]")
        if not "readonly" in elem.get_attribute('class'):
            self.assertTrue(
                False, "maxaccounts should be readonly for the domain admin")
        # also not tbitskolaboverallquota
        elem = self.driver.find_element_by_xpath(
            "//input[@name=\"tbitskolaboverallquota\"]")
        if not "readonly" in elem.get_attribute('class'):
            self.assertTrue(
                False, "overallquota should be readonly for the domain admin")

        kolabWAPhelper.logout_kolab_wap()

    # test if the domain admin can add users to his domain
    def test_domain_admin_create_user(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_domain_admin_edit_create_user")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin(
        )
        kolabWAPhelper.logout_kolab_wap()

        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", emailLogin, password)
        # check selected domain is correct
        currentdomain = kolabWAPhelper.get_selected_domain()
        self.assertEquals(domainname, currentdomain,
                          "should have selected domain " + domainname)
        kolabWAPhelper.create_user()
        kolabWAPhelper.logout_kolab_wap()

    # test if the domain admin can add users to another domain that he manages when he is not domainadmin in his own domain
    # this might need fixing. see https://github.com/TBits/KolabScripts/issues/67
    def test_domain_admin_create_user_other_domain(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log(
            "Running test: test_domain_admin_edit_create_user_other_domain")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin(
            only_create_admin=True)
        domainname2 = kolabWAPhelper.create_domain(username)
        kolabWAPhelper.logout_kolab_wap()

        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", emailLogin, password)
        kolabWAPhelper.select_domain(domainname2)
        self.driver.find_element_by_link_text("Users").click()
        kolabWAPhelper.wait_loading()
        if self.driver.page_source.find('class="formtitle">Add User<') != -1:
            self.assertTrue(
                False,
                "Domain Admin should not be able to add users because he is not domain admin in his own domain"
            )
        kolabWAPhelper.logout_kolab_wap()

    # test if ex-domain admin cannot add users
    def test_ex_domain_admin_without_permission(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log(
            "Running test: test_ex_domain_admin_without_permission")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin(
        )

        # now withdraw domainadmin permissions for this domain
        kolabWAPhelper.unlink_admin_from_domain(username, domainname)

        kolabWAPhelper.logout_kolab_wap()

        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", emailLogin, password)
        # check selected domain is correct
        currentdomain = kolabWAPhelper.get_selected_domain()
        self.assertEquals(domainname, currentdomain,
                          "should have selected domain " + domainname)

        self.driver.find_element_by_link_text("Users").click()
        kolabWAPhelper.wait_loading()

        didFail = True
        try:
            elem = self.driver.find_element_by_xpath(
                "//span[@class=\"formtitle\"]")
            didFail = False
        except:
            # all is fine, there should not be a Add User title, but an empty box
            pass

        if not didFail:
            self.assertTrue(
                False,
                "ex-domain admin should not be able to create new accounts")

        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):

        self.kolabWAPhelper.tear_down()

        self.driver.quit()
Exemplo n.º 30
0
class KolabUserMailhostLocalhost(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def modify_mailhost_default(self):
        driver = self.driver
        driver.get(driver.current_url)

        elem = driver.find_element_by_link_text("Settings")
        elem.click()
        self.kolabWAPhelper.wait_loading()
        elem = self.driver.find_element_by_id("searchinput")
        elem.send_keys("Kolab User")
        elem.send_keys(Keys.ENTER)
        self.kolabWAPhelper.wait_loading(initialwait = 2)
        elem = self.driver.find_element_by_xpath("//table[@id='settingstypelist']/tbody/tr/td")
        self.assertEquals("Kolab User", elem.text, "Expected to select Kolab User but was " + elem.text)
        elem.click()
        self.kolabWAPhelper.wait_loading(initialwait = 1)
        elem = driver.find_element_by_link_text("Attributes")
        elem.click()
        elem = driver.find_element_by_xpath("//tr[@id='attr_table_row_mailhost']/td[@class='actions']/a[@href='#edit']").click()
        self.kolabWAPhelper.wait_loading(0.5)
        driver.find_element_by_xpath("//tr[@id='attr_form_row_value']/td[@class='value']/select/option[@value='normal']").click()
        elem = driver.find_element_by_xpath("//tr[@id='attr_form_row_default']/td[@class='value']/input")
        elem.send_keys("localhost")
        driver.find_element_by_xpath("//input[@value='Save']").click()
        
        elem = driver.find_element_by_xpath("//input[@value=\"Submit\"]").click()
        self.kolabWAPhelper.wait_loading()
        elem = driver.find_element_by_xpath("//div[@id=\"message\"]")
        self.assertEquals("Object type updated successfully.", elem.text, "object type was not updated successfully, message: " + elem.text)

    def test_modify_mailhost_default(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_modify_mailhost_default")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        self.modify_mailhost_default()

        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.quit()
Exemplo n.º 31
0
class KolabWAPListQuotaReport(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    # test that unprivileged user cannot see the report
    def test_unprivileged_user(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_unprivileged_user")
        driver = self.driver

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

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

        kolabWAPhelper.logout_kolab_wap()

        # login as that user
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", uid, password)

        # check if report is available
        driver.find_element_by_link_text("Users").click()
        kolabWAPhelper.wait_loading()
        self.assertEquals(-1, driver.page_source.find('href="#report"'),
                          "should not display link to Report")

        # should get empty page when going to report directly
        driver.execute_script("return kadm.command('user.report', '', this)")
        kolabWAPhelper.wait_loading(1)
        # TODO currently this is still possible. but the user can see quota and last login anyway of other users at the moment
        #self.assertEquals(-1, driver.page_source.find('<th>Quota Usage</th>'), "should not display the Report");

        kolabWAPhelper.logout_kolab_wap()

    def test_user_admin_role(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_user_admin_role")
        driver = self.driver

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        username, emailLogin, password, uid = kolabWAPhelper.create_user(
            prefix="user", role="kolab-admin")

        kolabWAPhelper.logout_kolab_wap()

        # login as that user
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", uid, password)

        # check if report is available
        driver.find_element_by_link_text("Users").click()
        kolabWAPhelper.wait_loading()
        self.assertNotEquals(-1, driver.page_source.find('href="#report"'),
                             "should display link to Report")

        # should see the report
        driver.execute_script("return kadm.command('user.report', '', this)")
        kolabWAPhelper.wait_loading(1)
        self.assertNotEquals(-1,
                             driver.page_source.find('<th>Quota Usage</th>'),
                             "should display the Report")

        kolabWAPhelper.logout_kolab_wap()

    def test_domain_admin(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_domain_admin")
        driver = self.driver

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin(
        )

        kolabWAPhelper.logout_kolab_wap()

        # login as that user
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", username, password)

        # check if report is available
        driver.find_element_by_link_text("Users").click()
        kolabWAPhelper.wait_loading()
        self.assertNotEquals(-1, driver.page_source.find('href="#report"'),
                             "should display link to Report")

        # should see the report
        driver.execute_script("return kadm.command('user.report', '', this)")
        kolabWAPhelper.wait_loading(1)
        self.assertNotEquals(-1,
                             driver.page_source.find('<th>Quota Usage</th>'),
                             "should display the Report")

        kolabWAPhelper.logout_kolab_wap()

    def test_directory_manager(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_directory_manager")
        driver = self.driver

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        # check if report is available
        driver.find_element_by_link_text("Users").click()
        kolabWAPhelper.wait_loading()
        self.assertNotEquals(-1, driver.page_source.find('href="#report"'),
                             "should display link to Report")

        # should see the report
        driver.execute_script("return kadm.command('user.report', '', this)")
        kolabWAPhelper.wait_loading(1)
        self.assertNotEquals(-1,
                             driver.page_source.find('<th>Quota Usage</th>'),
                             "should display the Report")

        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):

        self.kolabWAPhelper.tear_down()

        self.driver.quit()
 def setUp(self):
     self.kolabWAPhelper = KolabWAPTestHelpers()
     self.driver = self.kolabWAPhelper.init_driver()
Exemplo n.º 33
0
class KolabWAPCreateUserAndEditSelf(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    # edit yourself; testing bug https://issues.kolab.org/show_bug.cgi?id=2414
    def helper_user_edits_himself(self):
        driver = self.driver
        elem = driver.find_element_by_xpath("//div[@class=\"settings\"]")
        elem.click()
        self.kolabWAPhelper.wait_loading(1.0)
        elem = driver.find_element_by_name("initials")
        elem.send_keys("T")
        elem = driver.find_element_by_xpath("//input[@value=\"Submit\"]")
        elem.click()
        self.kolabWAPhelper.wait_loading()
        elem = driver.find_element_by_xpath("//div[@id=\"message\"]")
        self.assertEquals(
            "User updated successfully.", elem.text,
            "User was not saved successfully, message: " + elem.text)

        self.kolabWAPhelper.log("User has updated his own data successfully")

    def test_edit_user_himself(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_edit_user_himself")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        username, emailLogin, password, uid = kolabWAPhelper.create_user()

        kolabWAPhelper.logout_kolab_wap()

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

        self.helper_user_edits_himself()

        kolabWAPhelper.logout_kolab_wap()

    def test_edit_user_himself_multi_domain_with_quota(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log(
            "Running test: test_edit_user_himself_multi_domain_with_quota")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        domainname = kolabWAPhelper.create_domain()

        username, emailLogin, password, uid = kolabWAPhelper.create_user(
            mail_quota="20kb")

        kolabWAPhelper.logout_kolab_wap()

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

        self.helper_user_edits_himself()

        kolabWAPhelper.logout_kolab_wap()

    def test_edit_user_himself_multi_domain(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_edit_user_himself_multi_domain")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        domainname = kolabWAPhelper.create_domain()

        username, emailLogin, password, uid = kolabWAPhelper.create_user()

        kolabWAPhelper.logout_kolab_wap()

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

        self.helper_user_edits_himself()

        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):

        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()

        self.driver.quit()
Exemplo n.º 34
0
class KolabUniqueIDAcrossDomains(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def enable_editable_uid(self):
        driver = self.driver
        driver.get(driver.current_url)

        elem = driver.find_element_by_link_text("Settings")
        elem.click()
        self.kolabWAPhelper.wait_loading()
        elem = self.driver.find_element_by_id("searchinput")
        elem.send_keys("Kolab User")
        elem.send_keys(Keys.ENTER)
        self.kolabWAPhelper.wait_loading(initialwait=2)
        elem = self.driver.find_element_by_xpath(
            "//table[@id='settingstypelist']/tbody/tr/td")
        self.assertEquals("Kolab User", elem.text,
                          "Expected to select Kolab User but was " + elem.text)
        elem.click()
        self.kolabWAPhelper.wait_loading(initialwait=1)
        elem = driver.find_element_by_link_text("Attributes")
        elem.click()
        elem = driver.find_element_by_xpath(
            "//tr[@id='attr_table_row_uid']/td[@class='actions']/a[@href='#edit']"
        ).click()
        self.kolabWAPhelper.wait_loading(0.5)
        driver.find_element_by_xpath(
            "//tr[@id='attr_form_row_value']/td[@class='value']/select/option[@value='auto']"
        ).click()
        driver.find_element_by_xpath("//input[@value='Save']").click()

        elem = driver.find_element_by_xpath(
            "//input[@value=\"Submit\"]").click()
        self.kolabWAPhelper.wait_loading()
        elem = driver.find_element_by_xpath("//div[@id=\"message\"]")
        self.assertEquals(
            "Object type updated successfully.", elem.text,
            "object type was not updated successfully, message: " + elem.text)

    def test_unique_id_across_domains(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_unique_id_across_domains")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        # create a user in the primary domain
        username = "******" + datetime.datetime.now().strftime(
            "%Y%m%d%H%M%S") + "uid"
        self.enable_editable_uid()
        username, emailLogin, password, uid = kolabWAPhelper.create_user(
            username=username, uid=username)

        # create a domain and select it
        domainname = kolabWAPhelper.create_domain()

        # attempt to create a user with the same username as in the primary domain, should result in a uid with digit 2 attached
        username, emailLogin, password, uid = kolabWAPhelper.create_user(
            username=username)
        self.assertEquals(
            username + "2", uid,
            "generate_uid should create a unique id across domains for same surname, expected "
            + username + "2, but got: " + uid)

        # attempt to create a user with the same uid as in the primary domain
        kolabWAPhelper.create_user(
            username=username,
            uid=username,
            expected_message_contains=("Error: The unique identity (UID) " +
                                       username + " is already in use."))

        # create a new user
        username = "******" + datetime.datetime.now().strftime("%Y%m%d%H%M%S")
        username, emailLogin, password, uid = kolabWAPhelper.create_user(
            username=username)
        kolabWAPhelper.logout_kolab_wap()

        # test kolab-saslauthd from the commandline
        print("testsaslauthd with " + emailLogin)
        p = subprocess.Popen("/usr/sbin/testsaslauthd -u " + emailLogin +
                             " -p '" + password + "'",
                             shell=True,
                             stdout=subprocess.PIPE)
        out, err = p.communicate()
        self.assertTrue('0: OK "Success."' in out,
                        "login did not work, it shows " + out)

        print("testsaslauthd with " + username)
        p = subprocess.Popen("/usr/sbin/testsaslauthd -u " + username +
                             " -p '" + password + "'",
                             shell=True,
                             stdout=subprocess.PIPE)
        out, err = p.communicate()
        self.assertTrue('0: OK "Success."' in out,
                        "login did not work, it shows " + out)

        print("testsaslauthd with wrong password")
        p = subprocess.Popen("/usr/sbin/testsaslauthd -u " + username +
                             " -p '" + password + "fail'",
                             shell=True,
                             stdout=subprocess.PIPE)
        out, err = p.communicate()
        self.assertTrue(
            '0: NO "authentication failed"' in out,
            "login should not work with wrong password, but it shows " + out)

        # login user to kolab webadmin with wrong password should fail
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", username,
                                       password + "fail",
                                       "Incorrect username or password!")

        # login user to kolab webadmin with the email login
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", emailLogin, password)
        kolabWAPhelper.logout_kolab_wap()

        # login user to kolab webadmin with just the uid
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", username, password)
        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):

        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()

        self.driver.quit()
Exemplo n.º 35
0
class KolabEmailMailForwarding(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_mail_forwarding(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_mail_forwarding")
        
        # login Directory Manager, create a user
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        # add the user
        username, emailLogin, password = kolabWAPhelper.create_user()
        
        # create a forward address
        username2, emailForwardAddress, password2 = kolabWAPhelper.create_user(forward_to=emailLogin)
        # wait a few seconds for the change to take effect
        time.sleep(10)
        
        kolabWAPhelper.logout_kolab_wap()

        # send email to the forward address from command line
        print "sending email to " + emailForwardAddress
        subject = 'for ' + username
        subprocess.call(['/bin/bash', '-c', 'echo "test" | mail -s "' + subject + '" ' + emailForwardAddress])
        time.sleep(10)

        # login user to roundcube and check for email
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin, password)
        kolabWAPhelper.check_email_received(emailSubjectLine=subject)
        kolabWAPhelper.logout_roundcube()

    def test_mail_forwarding_external(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_mail_forwarding_external")

        # login Directory Manager, create a user
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        # please modify following line to add a domain that actually can receive emails, ie. has a valid MX record
        enabled_maildomain="soliderp.net"
        # quit the test if that domain does not exist in the current setup
        kolabWAPhelper.select_domain(enabled_maildomain);

        # add the user
        username, emailLogin, password = kolabWAPhelper.create_user()

        # create a forward address
        # using an external echo address (see https://de.wikipedia.org/wiki/Echo-Mailer)
        username2, emailForwardAddress, password2 = kolabWAPhelper.create_user(forward_to="*****@*****.**")
        time.sleep(10)

        kolabWAPhelper.logout_kolab_wap()

        # login user to roundcube and check for email
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin, password)
        print "sending email to " + emailForwardAddress
        emailSubjectLine = kolabWAPhelper.send_email(emailForwardAddress)
        kolabWAPhelper.wait_loading(5.0)
        kolabWAPhelper.check_email_received(emailSubjectLine="Re: " + emailSubjectLine)
        kolabWAPhelper.logout_roundcube()

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.quit()
class KolabWAPCreateUserAndEditSelf(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    # edit yourself; testing bug https://issues.kolab.org/show_bug.cgi?id=2414
    def helper_user_edits_himself(self):
        driver = self.driver
        elem = driver.find_element_by_xpath("//div[@class=\"settings\"]")
        elem.click()
        self.kolabWAPhelper.wait_loading(1.0)
        elem = driver.find_element_by_name("initials")
        elem.send_keys("T")
        elem = driver.find_element_by_xpath("//input[@value=\"Submit\"]")
        elem.click()
        self.kolabWAPhelper.wait_loading()
        elem = driver.find_element_by_xpath("//div[@id=\"message\"]")
        self.assertEquals("User updated successfully.", elem.text, "User was not saved successfully, message: " + elem.text)
        
        self.kolabWAPhelper.log("User has updated his own data successfully")


    def test_edit_user_himself(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_edit_user_himself")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        username, emailLogin, password = kolabWAPhelper.create_user()

        kolabWAPhelper.logout_kolab_wap()

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

        self.helper_user_edits_himself()
        
        kolabWAPhelper.logout_kolab_wap()

    def test_edit_user_himself_multi_domain_with_quota(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_edit_user_himself_multi_domain_with_quota")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        domainname = kolabWAPhelper.create_domain()

        username, emailLogin, password = kolabWAPhelper.create_user(mail_quota="20kb")

        kolabWAPhelper.logout_kolab_wap()

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

        self.helper_user_edits_himself()
        
        kolabWAPhelper.logout_kolab_wap()

    def test_edit_user_himself_multi_domain(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_edit_user_himself_multi_domain")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        domainname = kolabWAPhelper.create_domain()

        username, emailLogin, password = kolabWAPhelper.create_user()

        kolabWAPhelper.logout_kolab_wap()

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

        self.helper_user_edits_himself()
        
        kolabWAPhelper.logout_kolab_wap()


    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.quit()
Exemplo n.º 37
0
class KolabWAPDomainAdmin(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    # test if correct user type is used in a normal domain
    def test_default_user_type_in_normal_domain(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_default_user_type_in_normal_domain")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

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

        # now edit the user
        kolabWAPhelper.load_user(username)

        # check if the user type is actually a normal kolab user
        elem = self.driver.find_element_by_xpath("//form[@id='user-form']/fieldset/table/tbody/tr/td[@class='value']")
        self.assertEquals("Kolab User", elem.text, "user type should be Kolab User, but was " + elem.text)

        kolabWAPhelper.logout_kolab_wap()

    def test_domain_admin_with_own_domain(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_domain_admin_with_own_domain")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin()

        # now edit the user
        self.driver.get(self.driver.current_url)
        elem = self.driver.find_element_by_link_text("Users")
        elem.click()
        kolabWAPhelper.wait_loading()
        elem = self.driver.find_element_by_id("searchinput")
        elem.send_keys(username)
        elem.send_keys(Keys.ENTER)
        kolabWAPhelper.wait_loading(initialwait = 2)

        elem = self.driver.find_element_by_xpath("//table[@id='userlist']/tbody/tr/td")
        self.assertEquals(username + ", " + username, elem.text, "Expected to select user " + username + " but was " + elem.text)
        elem.click()

        kolabWAPhelper.wait_loading(initialwait = 1)

        # check if the user type is a Kolab user with domain admin permissions
        elem = self.driver.find_element_by_xpath("//form[@id='user-form']/fieldset/table/tbody/tr/td[@class='value']")
        self.assertEquals("Kolab User", elem.text, "user type should be Kolab user, but was " + elem.text)
        elem = self.driver.find_element_by_link_text("Domain Administrator")
        elem.click()
        if not self.driver.find_element_by_xpath("//input[@name='tbitskolabisdomainadmin']").is_selected():
            self.assertTrue(False, "isDomainAdmin should be checked")

        kolabWAPhelper.logout_kolab_wap()

    # test that domain admin cannot edit its own maxaccount / overallquota
    def test_domain_admin_edit_own_parameters(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_domain_admin_edit_own_parameters")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin()
        kolabWAPhelper.logout_kolab_wap()

        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", emailLogin, password)
        elem = self.driver.find_element_by_xpath("//div[@class=\"settings\"]")
        elem.click()
        self.kolabWAPhelper.wait_loading()
        elem = self.driver.find_element_by_link_text("Domain Administrator")
        elem.click()
        self.kolabWAPhelper.wait_loading()
        # the domain admin should not be able to edit his own parameters, eg max accounts
        elem = self.driver.find_element_by_xpath("//input[@name=\"tbitskolabmaxaccounts\"]")
        if not "readonly" in elem.get_attribute('class'):
          self.assertTrue(False, "maxaccounts should be readonly for the domain admin")
        # also not tbitskolaboverallquota
        elem = self.driver.find_element_by_xpath("//input[@name=\"tbitskolaboverallquota\"]")
        if not "readonly" in elem.get_attribute('class'):
          self.assertTrue(False, "overallquota should be readonly for the domain admin")
        # and the checkbox for domainadmin itself should be readonly and disabled
        elem = self.driver.find_element_by_xpath("//input[@name=\"tbitskolabisdomainadmin\"]")
        if not "readonly" in elem.get_attribute('class'):
          self.assertTrue(False, "isdomainadmin should be readonly for the domain admin")
        if not elem.get_attribute('disabled') == 'true':
          self.assertTrue(False, "isdomainadmin should be disabled for the domain admin")

        kolabWAPhelper.logout_kolab_wap()

    # test if the domain admin can add users to his domain
    def test_domain_admin_create_user(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_domain_admin_edit_create_user")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin()
        kolabWAPhelper.logout_kolab_wap()

        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", emailLogin, password)
        # check selected domain is correct
        currentdomain=kolabWAPhelper.get_selected_domain()
        self.assertEquals(domainname, currentdomain, "should have selected domain " + domainname)
        kolabWAPhelper.create_user()
        kolabWAPhelper.logout_kolab_wap()

    # test if ex-domain admin cannot add users
    def test_ex_domain_admin_without_permission(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_ex_domain_admin_without_permission")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        username, emailLogin, password, domainname = kolabWAPhelper.create_domainadmin()

        # now withdraw domainadmin permissions
        kolabWAPhelper.load_user(username)
        self.driver.find_element_by_link_text("Domain Administrator").click()
        self.driver.find_element_by_xpath("//input[@name='tbitskolabisdomainadmin']").click()
        self.driver.find_element_by_xpath("//input[@value=\"Submit\"]").click()
 
        kolabWAPhelper.logout_kolab_wap()

        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", emailLogin, password)
        # check selected domain is correct
        currentdomain=kolabWAPhelper.get_selected_domain()
        self.assertEquals(domainname, currentdomain, "should have selected domain " + domainname)

        self.driver.find_element_by_link_text("Users").click()
        kolabWAPhelper.wait_loading()

        didFail=True
        try:
          elem = self.driver.find_element_by_xpath("//span[@class=\"formtitle\"]")
          didFail=False
        except:
          # all is fine, there should not be a Add User title, but an empty box
          pass

        if not didFail:
          self.assertTrue(False, "ex-domain admin should not be able to create new accounts")

        kolabWAPhelper.logout_kolab_wap()
        
    def tearDown(self):
        
        self.kolabWAPhelper.tear_down()
        
        self.driver.quit()
Exemplo n.º 38
0
class KolabEmailMailForwarding(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    def test_mail_forwarding(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_mail_forwarding")

        # login Directory Manager, create a user
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        # add the user
        username, emailLogin, password = kolabWAPhelper.create_user()

        # create a forward address
        username2, emailForwardAddress, password2 = kolabWAPhelper.create_user(
            forward_to=emailLogin)
        # wait a few seconds for the change to take effect
        time.sleep(10)

        kolabWAPhelper.logout_kolab_wap()

        # send email to the forward address from command line
        print "sending email to " + emailForwardAddress
        subject = 'for ' + username
        subprocess.call([
            '/bin/bash', '-c',
            'echo "test" | mail -s "' + subject + '" ' + emailForwardAddress
        ])
        time.sleep(10)

        # login user to roundcube and check for email
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin, password)
        kolabWAPhelper.check_email_received(emailSubjectLine=subject)
        kolabWAPhelper.logout_roundcube()

    def test_mail_forwarding_external(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_mail_forwarding_external")

        # login Directory Manager, create a user
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin",
                                       "cn=Directory Manager", "test")

        # please modify following line to add a domain that actually can receive emails, ie. has a valid MX record
        enabled_maildomain = "soliderp.net"
        # quit the test if that domain does not exist in the current setup
        kolabWAPhelper.select_domain(enabled_maildomain)

        # add the user
        username, emailLogin, password = kolabWAPhelper.create_user()

        # create a forward address
        # using an external echo address (see https://de.wikipedia.org/wiki/Echo-Mailer)
        username2, emailForwardAddress, password2 = kolabWAPhelper.create_user(
            forward_to="*****@*****.**")
        time.sleep(10)

        kolabWAPhelper.logout_kolab_wap()

        # login user to roundcube and check for email
        kolabWAPhelper.login_roundcube("/roundcubemail", emailLogin, password)
        print "sending email to " + emailForwardAddress
        emailSubjectLine = kolabWAPhelper.send_email(emailForwardAddress)
        kolabWAPhelper.wait_loading(5.0)
        kolabWAPhelper.check_email_received(emailSubjectLine="Re: " +
                                            emailSubjectLine)
        kolabWAPhelper.logout_roundcube()

    def tearDown(self):

        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()

        self.driver.quit()
class KolabWAPDomainAdmin(unittest.TestCase):

    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    # check that domain admin cannot assign too much quota to the user accounts
    def test_overall_quota_limit(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_overall_quota_limit")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        kolabWAPhelper.select_domain("administrators.org")

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

        # create domains, with domain admin
        domainname = kolabWAPhelper.create_domain(username)
        domainname2 = kolabWAPhelper.create_domain(username)
        
        # create user accounts
        kolabWAPhelper.select_domain(domainname)
        # test if no account has been created yet, validation will still kick in
        kolabWAPhelper.create_user(mail_quota = "2gb", expected_message_contains = "mailquota of the domain admin has been exceeded")
        kolabWAPhelper.create_user(mail_quota = "200mb")
        kolabWAPhelper.select_domain(domainname2)
        # should fail, exceeding the overall quota of the domain admin
        kolabWAPhelper.create_user(mail_quota = "900mb", expected_message_contains = "mailquota of the domain admin has been exceeded")
        kolabWAPhelper.create_user(mail_quota = "600mb")

        kolabWAPhelper.logout_kolab_wap()

    # test that a domain admin with a mail quota cannot create user mailboxes with no quota specified
    def test_unlimited_user_quota(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_unlimited_user_quota")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        kolabWAPhelper.select_domain("administrators.org")

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

        # create domain, with domain admin
        domainname = kolabWAPhelper.create_domain(username)
        
        # create user account
        kolabWAPhelper.create_user(expected_message_contains = "must specify a mailquota for the user")

        kolabWAPhelper.logout_kolab_wap()

    # test that a domain admin with no mail quota can create user mailboxes with as much quota as he wants
    def test_no_quota(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_no_quota")
        
        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

        kolabWAPhelper.select_domain("administrators.org")

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

        # create domain, with domain admin
        domainname = kolabWAPhelper.create_domain(username)
        
        # create user account with a quota
        kolabWAPhelper.create_user(mail_quota = "100mb")
        # without any quota for the user
        kolabWAPhelper.create_user()

        kolabWAPhelper.logout_kolab_wap()

    def tearDown(self):
        
        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()
        
        self.driver.close()
Exemplo n.º 40
0
 def setUp(self):
     self.kolabWAPhelper = KolabWAPTestHelpers()
     self.driver = self.kolabWAPhelper.init_driver()
class KolabWAPDomainAdmin(unittest.TestCase):
    def setUp(self):
        self.kolabWAPhelper = KolabWAPTestHelpers()
        self.driver = self.kolabWAPhelper.init_driver()

    # test if correct user type is used in a normal domain
    def test_default_user_type_in_normal_domain(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_default_user_type_in_normal_domain")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/kolab-webadmin", "cn=Directory Manager", "test")

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

        # now edit the user
        elem = self.driver.find_element_by_id("searchinput")
        elem.send_keys(username)
        elem.send_keys(Keys.ENTER)
        kolabWAPhelper.wait_loading(initialwait=2)

        elem = self.driver.find_element_by_xpath("//table[@id='userlist']/tbody/tr/td")
        self.assertEquals(
            username + ", " + username, elem.text, "Expected to select user " + username + " but was " + elem.text
        )
        elem.click()

        kolabWAPhelper.wait_loading(initialwait=1)

        # check if the user type is actually a normal kolab user
        elem = self.driver.find_element_by_xpath("//form[@id='user-form']/fieldset/table/tbody/tr/td[@class='value']")
        self.assertEquals("Kolab User", elem.text, "user type should be Kolab User, but was " + elem.text)

        kolabWAPhelper.logout_kolab_wap()

    # test if correct user type is used when not many attributes are set which are specific for domain admins
    def test_domain_admin_user_type(self):
        kolabWAPhelper = self.kolabWAPhelper
        kolabWAPhelper.log("Running test: test_domain_admin_user_type")

        # login Directory Manager
        kolabWAPhelper.login_kolab_wap("/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.ENTER)
        kolabWAPhelper.wait_loading(initialwait=2)

        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()

        kolabWAPhelper.wait_loading(initialwait=1)

        # 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 tearDown(self):

        # write current page for debugging purposes
        self.kolabWAPhelper.log_current_page()

        self.driver.close()