def test_file_load(self):
"""
Load the simple filters by file
"""
entry = copy(self.template_entry)
fb = NNTPFilterBase(paths=join(self.var_dir, 'simple.nrf'))
# Our hash will start at 0 (Zero)
assert len(fb._regex_hash) == 0
# But now we meet our score
entry['subject'] = 'A great video called "blah.avi"'
assert fb.blacklist(**entry) == False
entry['subject'] = 'A malicious file because it is "blah.avi.exe"'
assert fb.blacklist(**entry) == True
# Now load the directory; it should just find the same nrf file.
fbd = NNTPFilterBase(paths=self.var_dir)
评论列表
文章目录