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