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


Python TestCase.setUp方法代码示例

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


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

示例1: setUp

# 需要导入模块: from twistedcaldav.test.util import TestCase [as 别名]
# 或者: from twistedcaldav.test.util.TestCase import setUp [as 别名]
 def setUp(self):
     TestCase.setUp(self)
     self.notifier = StubNotifier()
     self.protocol = SimpleLineNotificationProtocol()
     self.protocol.notifier = self.notifier
     self.protocol.transport = StubTransport()
     self.notifier.addObserver(self.protocol)
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:9,代码来源:test_notify.py

示例2: setUp

# 需要导入模块: from twistedcaldav.test.util import TestCase [as 别名]
# 或者: from twistedcaldav.test.util.TestCase import setUp [as 别名]
 def setUp(self):
     """
     Create a L{MemCachePool}.
     """
     TestCase.setUp(self)
     self.reactor = StubReactor()
     self.pool = MemCachePool(MC_ADDRESS,
                              maxClients=5,
                              reactor=self.reactor)
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:11,代码来源:test_memcachepool.py

示例3: setUp

# 需要导入模块: from twistedcaldav.test.util import TestCase [as 别名]
# 或者: from twistedcaldav.test.util.TestCase import setUp [as 别名]
    def setUp(self):
        TestCase.setUp(self)
        self.memcache = InMemoryMemcacheProtocol()
        self.ccn = MemcacheChangeNotifier(
            StubURLResource(':memory:'),
            cachePool=self.memcache)

        self.ccn._newCacheToken = instancemethod(_newCacheToken,
                                                 self.ccn,
                                                 MemcacheChangeNotifier)
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:12,代码来源:test_cache.py

示例4: setUp

# 需要导入模块: from twistedcaldav.test.util import TestCase [as 别名]
# 或者: from twistedcaldav.test.util.TestCase import setUp [as 别名]
 def setUp(self):
     """
     Set up our options object, giving it a parent, and forcing the
     global config to be loaded from defaults.
     """
     TestCase.setUp(self)
     self.config = TestCalDAVOptions()
     self.config.parent = Options()
     self.config.parent["uid"] = 0
     self.config.parent["gid"] = 0
     self.config.parent["nodaemon"] = False
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:13,代码来源:test_caldav.py

示例5: setUp

# 需要导入模块: from twistedcaldav.test.util import TestCase [as 别名]
# 或者: from twistedcaldav.test.util.TestCase import setUp [as 别名]
    def setUp(self):
        TestCase.setUp(self)
        self.options = TestCalDAVOptions()
        self.options.parent = Options()
        self.options.parent["gid"] = None
        self.options.parent["uid"] = None
        self.options.parent["nodaemon"] = None

        self.config = ConfigDict(DEFAULT_CONFIG)

        accountsFile = os.path.join(sourceRoot, "twistedcaldav/directory/test/accounts.xml")
        resourcesFile = os.path.join(sourceRoot, "twistedcaldav/directory/test/resources.xml")
        augmentsFile = os.path.join(sourceRoot, "twistedcaldav/directory/test/augments.xml")
        pemFile = os.path.join(sourceRoot, "twistedcaldav/test/data/server.pem")

        self.config["DirectoryService"] = {
            "params": {"xmlFile": accountsFile},
            "type": "twistedcaldav.directory.xmlfile.XMLDirectoryService"
        }

        self.config["ResourceService"] = {
            "params": {"xmlFile": resourcesFile},
        }

        self.config["AugmentService"] = {
            "params": {"xmlFiles": [augmentsFile]},
            "type": "twistedcaldav.directory.augment.AugmentXMLDB"
        }

        self.config.UseDatabase    = False
        self.config.ServerRoot     = self.mktemp()
        self.config.ConfigRoot     = "config"
        self.config.ProcessType    = "Single"
        self.config.SSLPrivateKey  = pemFile
        self.config.SSLCertificate = pemFile
        self.config.EnableSSL      = True
        self.config.Memcached.Pools.Default.ClientEnabled = False
        self.config.Memcached.Pools.Default.ServerEnabled = False
        self.config.DirectoryAddressBook.Enabled = False

        self.config.SudoersFile = ""

        if self.configOptions:
            self.config.update(self.configOptions)

        os.mkdir(self.config.ServerRoot)
        os.mkdir(os.path.join(self.config.ServerRoot, self.config.DocumentRoot))
        os.mkdir(os.path.join(self.config.ServerRoot, self.config.DataRoot))
        os.mkdir(os.path.join(self.config.ServerRoot, self.config.ConfigRoot))

        self.configFile = self.mktemp()

        self.writeConfig()
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:55,代码来源:test_caldav.py

示例6: setUp

# 需要导入模块: from twistedcaldav.test.util import TestCase [as 别名]
# 或者: from twistedcaldav.test.util.TestCase import setUp [as 别名]
 def setUp(self):
     """
     Create a memcache client, connect it to a string protocol, and make it
     use a deterministic clock.
     """
     TestCase.setUp(self)
     self.proto = MemCacheProtocol()
     self.clock = Clock()
     self.proto.callLater = self.clock.callLater
     self.transport = StringTransportWithDisconnection()
     self.transport.protocol = self.proto
     self.proto.makeConnection(self.transport)
开发者ID:eventable,项目名称:CalendarServer,代码行数:14,代码来源:test_memcachelock.py

示例7: setUp

# 需要导入模块: from twistedcaldav.test.util import TestCase [as 别名]
# 或者: from twistedcaldav.test.util.TestCase import setUp [as 别名]
 def setUp(self):
     """
     Create a L{MemCachePool}.
     """
     TestCase.setUp(self)
     self.reactor = StubReactor()
     self.pool = MemCachePool(
         TCP4ClientEndpoint(self.reactor, MC_ADDRESS.host, MC_ADDRESS.port),
         maxClients=5, reactor=self.reactor
     )
     realClientFactory = self.pool.clientFactory
     self.clientFactories = []
     def capturingClientFactory(*a, **k):
         cf = realClientFactory(*a, **k)
         self.clientFactories.append(cf)
         return cf
     self.pool.clientFactory = capturingClientFactory
开发者ID:nunb,项目名称:calendarserver,代码行数:19,代码来源:test_memcachepool.py

示例8: setUp

# 需要导入模块: from twistedcaldav.test.util import TestCase [as 别名]
# 或者: from twistedcaldav.test.util.TestCase import setUp [as 别名]
    def setUp(self):
        """
        Create a DigestCredentialFactory for testing
        """
        TestCase.setUp(self)
        config.ProcessType = "Single"

        self.namespace1 = "DIGEST1"
        self.namespace2 = "DIGEST2"

        self.credentialFactories = (QopDigestCredentialFactory(
                                          'md5',
                                          'auth',
                                          'test realm',
                                          self.namespace1
                                      ),
                                      QopDigestCredentialFactory(
                                          'md5',
                                          '',
                                          'test realm',
                                          self.namespace2
                                      ))
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:24,代码来源:test_digest.py

示例9: setUp

# 需要导入模块: from twistedcaldav.test.util import TestCase [as 别名]
# 或者: from twistedcaldav.test.util.TestCase import setUp [as 别名]
    def setUp(self):
        """
        Set up our options object, giving it a parent, and forcing the
        global config to be loaded from defaults.
        """
        TestCase.setUp(self)
        self.options = CalDAVTaskOptions()
        self.options.parent = Options()
        self.options.parent["uid"] = 0
        self.options.parent["gid"] = 0
        self.options.parent["nodaemon"] = False

        self.config = ConfigDict(DEFAULT_CONFIG)

        accountsFile = os.path.join(sourceRoot, "twistedcaldav/directory/test/accounts.xml")
        self.config["DirectoryService"] = {
            "params": {"xmlFile": accountsFile},
            "type": "twistedcaldav.directory.xmlfile.XMLDirectoryService"
        }

        self.config.DocumentRoot   = self.mktemp()
        self.config.DataRoot       = self.mktemp()
        self.config.ProcessType    = "Single"
        self.config.Memcached.ClientEnabled = False
        self.config.Memcached.ServerEnabled = False


        pemFile = os.path.join(sourceRoot, "twistedcaldav/test/data/server.pem")
        self.config.SSLPrivateKey = pemFile
        self.config.SSLCertificate = pemFile

        os.mkdir(self.config.DocumentRoot)
        os.mkdir(self.config.DataRoot)

        self.configFile = self.mktemp()

        self.writeConfig()
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:39,代码来源:test_task.py

示例10: setUp

# 需要导入模块: from twistedcaldav.test.util import TestCase [as 别名]
# 或者: from twistedcaldav.test.util.TestCase import setUp [as 别名]
 def setUp(self):
     TestCase.setUp(self)
     self.resource = CalDAVResource()
     self.resource._dead_properties = InMemoryPropertyStore()
开发者ID:nunb,项目名称:calendarserver,代码行数:6,代码来源:test_resource.py

示例11: setUp

# 需要导入模块: from twistedcaldav.test.util import TestCase [as 别名]
# 或者: from twistedcaldav.test.util.TestCase import setUp [as 别名]
 def setUp(self):
     TestCase.setUp(self)
     self.handler = MailHandler(dataRoot=":memory:")
     self.dataDir = os.path.join(os.path.dirname(__file__), "data", "mail")
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:6,代码来源:test_mail.py

示例12: setUp

# 需要导入模块: from twistedcaldav.test.util import TestCase [as 别名]
# 或者: from twistedcaldav.test.util.TestCase import setUp [as 别名]
 def setUp(self):
     TestCase.setUp(self)
     config.setProvider(PListConfigProvider(DEFAULT_CONFIG))
     self.testConfig = self.mktemp()
     open(self.testConfig, "w").write(testConfig)
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:7,代码来源:test_config.py


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