def testNoBloatBetweenSessions(self): persistfilename = tempfile.gettempdir() + '\\temptaoggregatordb.db' #os.remove(persistfilename) if not os.path.exists(persistfilename): db = database.create_new_db(persistfilename) items = self.insertItems(5, db) else: db = database.ServiceDatabase(persistfilename) items = list(db.get_slice()) #ensure there are only 5 in here when we start- no bloat, or was created correctly first time self.assertEqual(db.itemcount(), 5) #now refresh items and make sure it doesn't bloat now or ever db.update_items(*items) self.assertEqual(db.itemcount(), 5)
def setUp(self): state = ServiceState(tempfile.mkstemp('.yaml')[1], sec_between_sync=0) db = database.create_new_db(tempfile.mkstemp('.db')[1]) self.service = taoggregatorservice.TaoggregatorServiceImpl(service_state=state, service_database=db) self.service.contentsources = [MockContentSource(createTestContentItems('s1', 's1html')), MockContentSource(createTestContentItems('s2', 's2html'))]
def setUp(self): self.filename = tempfile.mkstemp(suffix='.db')[1] self.db = database.create_new_db(self.filename)