Esempio n. 1
0
 def test_fake_tld(self):
     # we shouldn't extract domains that aren't domains
     self.set_input("not.a.domainatall")
     ng = FeedFilter(filter="AU", infile=self.fh)
     matches = list(ng.extract_matches())
     self.assert_matches(matches, [])
Esempio n. 2
0
 def test_email_addy(self):
     self.set_input("*****@*****.**")
     ng = FeedFilter(filter="AU", infile=self.fh)
     matches = list(ng.extract_matches())
     self.assert_matches(matches, [("domain", "sample.com")])
Esempio n. 3
0
 def test_multi_line(self):
     self.set_input("1.1.1.1     |    http://www.space.com     |     Telephone network\n \
                     2.2.2.2     |    http://nextsite.com      |     ISP")
     ng = FeedFilter(filter="AU", infile=self.fh)
     matches = list(ng.extract_matches())
     self.assert_matches(matches, [("ip", "1.1.1.1"), ("domain", "www.space.com"), ("ip", "2.2.2.2"), ("domain", "nextsite.com")])
Esempio n. 4
0
 def test_comma_sep_with_spaces(self):
     self.set_input("1.1.1.1     ,    http://www.space.com     ,     Telephone network")
     ng = FeedFilter(filter="AU", infile=self.fh)
     matches = list(ng.extract_matches())
     self.assert_matches(matches, [("ip", "1.1.1.1"), ("domain", "www.space.com")])
Esempio n. 5
0
 def test_comma_sep_with_quotes(self):
     self.set_input("'1.1.1.1','2.2.2.2','3.3.3.3'")
     ng = FeedFilter(filter="AU", infile=self.fh)
     matches = list(ng.extract_matches())
     self.assert_matches(matches, [("ip", "1.1.1.1"), ("ip", "2.2.2.2"), ("ip", "3.3.3.3")])
Esempio n. 6
0
 def test_comma_sep(self):
     self.set_input("1.1.1.1,2.2.2.2,3.3.3.3")
     ng = FeedFilter(filter="AU", infile=self.fh)
     matches = list(ng.extract_matches())
     self.assert_matches(matches, [("ip", "1.1.1.1"), ("ip", "2.2.2.2"), ("ip", "3.3.3.3")])