def test_setLastAccessed(self): t = self.t.new('xyzzy') ft = fauxtime.time() self.assert_(t.getLastAccessed() <= ft) fauxtime.sleep(self.timeout * 2) # go to sleep past the granularity ft2 = fauxtime.time() t.setLastAccessed() ft3 = fauxtime.time() self.assert_(t.getLastAccessed() <= ft3) self.assert_(t.getLastAccessed() >= ft2)
def test_setLastAccessed(self): t = self.t.new('xyzzy') ft = fauxtime.time() self.assert_(t.getLastAccessed() <= ft) fauxtime.sleep(self.timeout) # go to sleep past the granuarity ft2 = fauxtime.time() t.setLastAccessed() ft3 = fauxtime.time() self.assert_(t.getLastAccessed() <= ft3) self.assert_(t.getLastAccessed() >= ft2)
def test_setLastAccessed(self): t = self.t.new('xyzzy') ft = fauxtime.time() assert t.getLastAccessed() <= ft fauxtime.sleep(self.timeout) # go to sleep past the granuarity ft2 = fauxtime.time() t.setLastAccessed() ft3 = fauxtime.time() assert t.getLastAccessed() <= ft3 assert t.getLastAccessed() >= ft2
def testAddNotification(self): self.app.sm.setAddNotificationTarget(addNotificationTarget) sdo = self.app.sm.new_or_existing('TempObject') now = fauxtime.time() k = sdo.get('starttime') self.assertEqual(type(k), type(now)) self.assert_(k <= now)
def testAddNotification(self): self.app.sm.setAddNotificationTarget(addNotificationTarget) sdo = self.app.sm.new_or_existing('TempObject') now = fauxtime.time() k = sdo.get('starttime') assert type(k) == type(now) assert k <= now
def testDelNotification(self): self.app.sm.setDelNotificationTarget(delNotificationTarget) sdo = self.app.sm.new_or_existing('TempObject') # sleep longer than timeout fauxtime.sleep(self.timeout * 100.0) self.app.sm.get('TempObject') now = fauxtime.time() k = sdo.get('endtime') self.assertEqual(type(k), type(now)) self.assert_(k <= now)
def testDelNotification(self): self.app.sm.setDelNotificationTarget(delNotificationTarget) sdo = self.app.sm.new_or_existing('TempObject') timeout = self.timeout * 60 # sleep 2X longer than timeout? doesnt work at 1.1X, 1.5X? fauxtime.sleep(timeout * 2) sdo1 = self.app.sm.get('TempObject') now = fauxtime.time() k = sdo.get('endtime') self.assertEqual(type(k), type(now)) self.assert_(k <= now)
def testDelNotification(self): self.app.sm.setDelNotificationTarget(delNotificationTarget) sdo = self.app.sm.new_or_existing('TempObject') timeout = self.timeout * 60 fauxtime.sleep(timeout + (timeout * .75)) sdo1 = self.app.sm.get('TempObject') # force the sdm to do housekeeping self.app.sm._housekeep(self.app.sm._deindex_next() - self.app.sm._period) now = fauxtime.time() k = sdo.get('endtime') assert (type(k) == type(now)), type(k) assert k <= now, (k, now)
def delNotificationTarget(item, context): item['endtime'] = fauxtime.time()
def testSetLastModified(self): t = self.t.new('xyzzy') ft = fauxtime.time() t.setLastModified() assert t.getLastModified() is not None
def test_getCreated(self): t = self.t.new('xyzzy') ft = fauxtime.time() assert t.getCreated() <= ft
def test_getLastAccessed(self): t = self.t.new('xyzzy') ft = fauxtime.time() assert t.getLastAccessed() <= ft
def testSetLastModified(self): t = self.t.new('xyzzy') ft = fauxtime.time() t.setLastModified() self.failIfEqual(t.getLastModified(), None)
def addNotificationTarget(item, context): item['starttime'] = fauxtime.time()
def test_getLastAccessed(self): t = self.t.new('xyzzy') ft = fauxtime.time() self.assert_(t.getLastAccessed() <= ft)
def test_getCreated(self): t = self.t.new('xyzzy') ft = fauxtime.time() self.assert_(t.getCreated() <= ft)