当前位置: 首页>>代码示例>>Python>>正文


Python KolabWAPTestHelpers.log方法代码示例

本文整理汇总了Python中helperKolabWAP.KolabWAPTestHelpers.log方法的典型用法代码示例。如果您正苦于以下问题:Python KolabWAPTestHelpers.log方法的具体用法?Python KolabWAPTestHelpers.log怎么用?Python KolabWAPTestHelpers.log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在helperKolabWAP.KolabWAPTestHelpers的用法示例。


在下文中一共展示了KolabWAPTestHelpers.log方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: KolabAutoCreateFolders

# 需要导入模块: from helperKolabWAP import KolabWAPTestHelpers [as 别名]
# 或者: from helperKolabWAP.KolabWAPTestHelpers import log [as 别名]
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()
开发者ID:WebSpider,项目名称:kolab3_tbits_scripts,代码行数:61,代码来源:testAutoCreateFolders.py

示例2: KolabWAPCreateUserAndEditSelf

# 需要导入模块: from helperKolabWAP import KolabWAPTestHelpers [as 别名]
# 或者: from helperKolabWAP.KolabWAPTestHelpers import log [as 别名]
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()
开发者ID:Celera,项目名称:KolabScripts,代码行数:90,代码来源:testCreateUserAndEditSelf.py


注:本文中的helperKolabWAP.KolabWAPTestHelpers.log方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。