Exemplo 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, [])
Exemplo 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")])
Exemplo 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")])
Exemplo 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")])
Exemplo 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")])
Exemplo 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")])