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="catchall@" + 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(emailSubjectLine=subject) kolabWAPhelper.logout_roundcube() def tearDown(self): self.kolabWAPhelper.tear_down()
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="catchall@" + 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(emailSubjectLine=subject) kolabWAPhelper.logout_roundcube() def tearDown(self): self.kolabWAPhelper.tear_down()
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()
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()
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()
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()