本文整理汇总了Python中helperKolabWAP.KolabWAPTestHelpers类的典型用法代码示例。如果您正苦于以下问题:Python KolabWAPTestHelpers类的具体用法?Python KolabWAPTestHelpers怎么用?Python KolabWAPTestHelpers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KolabWAPTestHelpers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: KolabRoundcubeChangePassword
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")
示例2: KolabEmailSendAndReceiveEmail
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()
示例3: KolabWAPDomainAdmin
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()
示例4: KolabEmailCatchAll
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()
示例5: KolabAutoCreateFolders
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()
示例6: KolabWAPLastLogin
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()
示例7: KolabWAPDomainAdmin
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()
示例8: KolabEmailSharedFolders
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()
示例9: test_domain_admin_user_type
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()
示例10: KolabEmailCatchAllAcrossDomains
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 = "user" + 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="[email protected]" + aliasdomainname,
expected_message_contains="Alias '[email protected]" + 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="[email protected]" + 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 + '" [email protected]' + 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()
示例11: KolabWAPDomainAdmin
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()
示例12: KolabWAPDomainAdmin
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()
示例13: test_edit_user_himself
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()
示例14: test_domain_admin
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()
示例15: test_modified_foldername_in_new_domain
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)