def setUp(self): self.domain0 = testcfg.get('filter.domain.0', '') self.domain1 = testcfg.get('filter.domain.1', '') self.domain2 = testcfg.get('filter.domain.2', '') self.domain3 = testcfg.get('filter.domain.3', '') self.domain4 = testcfg.get('filter.domain.4', '') testcfg.set('filter.domain.0', '.xyz.com') # domain start by '.' testcfg.set('filter.domain.1', ' abc.com , , def ') # whitespaces, nothing between ,, testcfg.set('filter.domain.2', ',') # lone , testcfg.set('filter.domain.3', '') # blank testcfg.set('filter.domain.4', '')
def _invoke_dispose(self, minfo, cfp, mlog): """ Helper to set 'mlog' config and then invoke dispose() """ mlog0 = testcfg.get('messagelog.mlog') testcfg.cparser.set('messagelog', 'mlog', mlog) try: self.mlog.dispose(minfo, cfp, self.starttime) finally: testcfg.set('messagelog.mlog', mlog0)
def setUp(self): messagelog.mlog = messagelog.MsgLogger() # prepare some configuration for this test self.interval0 = testcfg.get('indexing.interval' ) self.numDoc0 = testcfg.get('indexing.numDoc' ) self.max_interval0 = testcfg.get('indexing.max_interval') testcfg.set('indexing.interval' , '3' ) testcfg.set('indexing.numDoc' , '5' ) testcfg.set('indexing.max_interval', '360') # make dummy queued msg 0.tmp self.logpath = testcfg.getpath('logs') self.path0 = self.logpath/'0.tmp' self.path0.touch() # create empty file dt0 = datetime.datetime(2000,1,1,10,00,0) mtime = time.mktime(dt0.timetuple()) # first queued: 2000-1-1 10:00 localtime self.path0.utime((mtime, mtime))
def test_version(self): # check for the version document added to new index reader = lucene_logic.Reader() version = testcfg.get('version.number', '?') self.assertEqual(1, reader.numDocs()) self.assertEqual(version, reader.getVersion())