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


Python KolabWAPTestHelpers.startKolabServer方法代码示例

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


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

示例1: KolabAutoCreateFolders

# 需要导入模块: from helperKolabWAP import KolabWAPTestHelpers [as 别名]
# 或者: from helperKolabWAP.KolabWAPTestHelpers import startKolabServer [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()

        # 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()
开发者ID:Celera,项目名称:KolabScripts,代码行数:93,代码来源:testAutoCreateFolders.py


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