def testDomain(self): fp = open(self.fname,'w') print >>fp,'spammer.com' fp.close() cache = AddrCache(fname=self.fname) cache.load(self.fname,30) self.failUnless('spammer.com' in cache)
def testDomain(self): fp = open(self.fname, 'w') print >> fp, 'spammer.com' fp.close() cache = AddrCache(fname=self.fname) cache.load(self.fname, 30) self.failUnless('spammer.com' in cache)
def testAdd(self): cache = AddrCache(fname=self.fname) cache['*****@*****.**'] = None cache.addperm('*****@*****.**') cache['*****@*****.**'] = 'testing' self.failUnless(cache.has_key('*****@*****.**')) self.failUnless(not cache.has_key('*****@*****.**')) self.failUnless('*****@*****.**' in cache) self.assertEquals(cache['*****@*****.**'],'testing') s = open(self.fname).readlines() self.failUnless(len(s) == 2) self.failUnless(s[0].startswith('[email protected] ')) self.assertEquals(s[1].strip(),'*****@*****.**') # check that new result overrides old cache['*****@*****.**'] = None self.failUnless(not cache['*****@*****.**'])
def testAdd(self): cache = AddrCache(fname=self.fname) cache['*****@*****.**'] = None cache.addperm('*****@*****.**') cache['*****@*****.**'] = 'testing' self.assertTrue(cache.has_key('*****@*****.**')) self.assertTrue(not cache.has_key('*****@*****.**')) self.assertTrue('*****@*****.**' in cache) self.assertEquals(cache['*****@*****.**'],'testing') s = open(self.fname).readlines() self.assertTrue(len(s) == 2) self.assertTrue(s[0].startswith('[email protected] ')) self.assertEquals(s[1].strip(),'*****@*****.**') # check that new result overrides old cache['*****@*****.**'] = None self.assertTrue(not cache['*****@*****.**'])
def testDomain(self): with open(self.fname,'w') as fp: print('spammer.com',file=fp) cache = AddrCache(fname=self.fname) cache.load(self.fname,30) self.assertTrue('spammer.com' in cache)