Ejemplo n.º 1
0
    def test_filter_ips(self):
        ips = find_ips(LIST_OF_IPS)
        store_ips(self.test_cache, ips)
        geoip_lookup(MMDB, self.test_cache)

        result1 = filter_ips(self.test_cache, 'country == US')
        self.assertEqual(len(result1), 1856)

        result2 = filter_ips(self.test_cache, 'country != US')
        self.assertEqual(len(result2), 3144)

        result3 = filter_ips(self.test_cache, 'state == NY or state == PA')
        self.assertEqual(len(result3), 20)

        result4 = filter_ips(self.test_cache, 'state == UT and state == NV')
        self.assertEqual(len(result4), 0)
Ejemplo n.º 2
0
    def test_filter_ips(self):
        ips = find_ips(LIST_OF_IPS)
        store_ips(self.test_cache, ips)
        geoip_lookup(MMDB, self.test_cache)

        result1 = filter_ips(self.test_cache, 'country == US')
        self.assertEqual(len(result1), 1856)

        result2 = filter_ips(self.test_cache, 'country != US')
        self.assertEqual(len(result2), 3144)

        result3 = filter_ips(self.test_cache, 'state == NY or state == PA')
        self.assertEqual(len(result3), 20)

        result4 = filter_ips(self.test_cache, 'state == UT and state == NV')
        self.assertEqual(len(result4), 0)
Ejemplo n.º 3
0
 def test_geoip_lookup(self):
     ips = find_ips(LIST_OF_IPS)
     store_ips(self.test_cache, ips)
     result = geoip_lookup(MMDB, self.test_cache)
     self.assertEqual(len(result), 113)