示例#1
0
 def testAddRAMCache(self):
     # Test it twice
     for i in range(2):
         sm = getSiteManager()
         sm.unregisterUtility(provided=IRAMCache)
         util = queryUtility(IRAMCache)
         self.assertEqual(util.maxAge, 86400)
         addOrReplaceRamCache(self.portal)
         util = queryUtility(IRAMCache)
         self.assertEqual(util.maxAge, 3600)
示例#2
0
 def testAddRAMCache(self):
     # Test it twice
     for i in range(2):
         sm = getSiteManager()
         sm.unregisterUtility(provided=IRAMCache)
         util = queryUtility(IRAMCache)
         self.assertEqual(util.maxAge, 86400)
         addOrReplaceRamCache(self.portal)
         util = queryUtility(IRAMCache)
         self.assertEqual(util.maxAge, 3600)
示例#3
0
    def testReplaceOldRamCache(self):
        sm = getSiteManager()

        # Test it twice
        for i in range(2):
            sm.unregisterUtility(provided=IRAMCache)
            from zope.app.cache.interfaces.ram import IRAMCache as OldIRAMCache
            from zope.app.cache.ram import RAMCache as OldRAMCache
            sm.registerUtility(factory=OldRAMCache, provided=OldIRAMCache)

            addOrReplaceRamCache(self.portal)
            util = queryUtility(IRAMCache)
            self.assertEqual(util.maxAge, 3600)
示例#4
0
    def testReplaceOldRamCache(self):
        sm = getSiteManager()

        # Test it twice
        for i in range(2):
            sm.unregisterUtility(provided=IRAMCache)
            from zope.app.cache.interfaces.ram import IRAMCache as OldIRAMCache
            from zope.app.cache.ram import RAMCache as OldRAMCache
            sm.registerUtility(factory=OldRAMCache, provided=OldIRAMCache)

            addOrReplaceRamCache(self.portal)
            util = queryUtility(IRAMCache)
            self.assertEqual(util.maxAge, 3600)