def testLoad0(self): testcfg.set('filter.domain.0', '') testcfg.set('filter.domain.1', '') testcfg.set('filter.domain.2', '') testcfg.set('filter.domain.3', '') testcfg.set('filter.domain.4', '') domain_filter.load() self.assertEqual(0, len(domain_filter.g_exdm))
def testFilter0(self): testcfg.set('filter.domain.0', '') testcfg.set('filter.domain.1', '') testcfg.set('filter.domain.2', '') testcfg.set('filter.domain.3', '') testcfg.set('filter.domain.4', '') domain_filter.g_exdm = None # force reload self.assertEqual(None, domain_filter.match('')) self.assertEqual(None, domain_filter.match('http://abc'))
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): 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 tearDown(self): """ Reset things we have altered. """ messagelog.mlog = messagelog.MsgLogger() # reset messagelog.mlog testcfg.set('indexing.interval' , self.interval0 ) # reset configurations testcfg.set('indexing.numDoc' , self.numDoc0 ) testcfg.set('indexing.max_interval', self.max_interval0) self.path0.remove() # remove dummy queued msg
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 tearDown(self): testcfg.set('filter.domain.0', self.domain0) testcfg.set('filter.domain.1', self.domain1) testcfg.set('filter.domain.2', self.domain2) testcfg.set('filter.domain.3', self.domain3) testcfg.set('filter.domain.4', self.domain4)