def test_filter_results4(self): """Tests filter results where we have success from both of the filters.""" expected_results = [self.sagan_results[3]] filters = [ FilterFactory.create("asn_v6", "4446"), FilterFactory.create("country_code", "NL") ] self.assertEqual(filter_results(filters, self.sagan_results), expected_results)
def test_filter_results4(self): """Tests filter results where we have success from both of the filters.""" expected_results = [self.sagan_results[3]] filters = [ FilterFactory.create("asn_v6", "4446"), FilterFactory.create("country_code", "NL") ] self.assertEqual( filter_results(filters, self.sagan_results), expected_results )
def test_filter_results2(self): """Tests filter results where we have no results match with multiple filters.""" expected_results = [] filters = [ FilterFactory.create("asn", 3336), FilterFactory.create("country_code", "DK"), FilterFactory.create("asn_v6", "3") ] self.assertEqual(filter_results(filters, self.sagan_results), expected_results)
def test_filter_results2(self): """Tests filter results where we have no results match with multiple filters.""" expected_results = [] filters = [ FilterFactory.create("asn", 3336), FilterFactory.create("country_code", "DK"), FilterFactory.create("asn_v6", "3") ] self.assertEqual( filter_results(filters, self.sagan_results), expected_results )
def test_filter_results1(self): """Tests filter results where we have 3 results match with 2 filters.""" expected_results = [ self.sagan_results[0], self.sagan_results[2], self.sagan_results[3] ] filters = [ FilterFactory.create("asn", 3337), FilterFactory.create("country_code", "NL") ] self.assertEqual(filter_results(filters, self.sagan_results), expected_results)
def test_filter_results1(self): """Tests filter results where we have 3 results match with 2 filters.""" expected_results = [ self.sagan_results[0], self.sagan_results[2], self.sagan_results[3] ] filters = [ FilterFactory.create("asn", 3337), FilterFactory.create("country_code", "NL") ] self.assertEqual( filter_results(filters, self.sagan_results), expected_results )
def test_factory_create(self): """Test factory create.""" self.assertIsInstance(FilterFactory.create("country", "GR"), Filter) self.assertIsInstance(FilterFactory.create("asn", "3333"), ASNFilter)