本文整理汇总了Python中helperKolabWAP.KolabWAPTestHelpers.tear_down方法的典型用法代码示例。如果您正苦于以下问题:Python KolabWAPTestHelpers.tear_down方法的具体用法?Python KolabWAPTestHelpers.tear_down怎么用?Python KolabWAPTestHelpers.tear_down使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helperKolabWAP.KolabWAPTestHelpers
的用法示例。
在下文中一共展示了KolabWAPTestHelpers.tear_down方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: KolabEmailCatchAll
# 需要导入模块: from helperKolabWAP import KolabWAPTestHelpers [as 别名]
# 或者: from helperKolabWAP.KolabWAPTestHelpers import tear_down [as 别名]
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="[email protected]" + 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()
示例2: KolabWAPDomainAdmin
# 需要导入模块: from helperKolabWAP import KolabWAPTestHelpers [as 别名]
# 或者: from helperKolabWAP.KolabWAPTestHelpers import tear_down [as 别名]
#.........这里部分代码省略.........
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()