예제 #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)
예제 #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)
예제 #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)
예제 #4
0
 def test_store_ips(self):
     ips = find_ips(LIST_OF_IPS)
     store_ips(self.test_cache, ips)
     with open(self.test_cache) as f:
         stored_ips = json.loads(f.read())
     self.assertEqual(len(stored_ips), 5000)
예제 #5
0
 def test_find_ips(self):
     ips = find_ips(LIST_OF_IPS)
     self.assertEqual(len(ips), 5000)
예제 #6
0
 def test_store_ips(self):
     ips = find_ips(LIST_OF_IPS)
     store_ips(self.test_cache, ips)
     with open(self.test_cache) as f:
         stored_ips = json.loads(f.read())
     self.assertEqual(len(stored_ips), 5000)
예제 #7
0
 def test_find_ips(self):
     ips = find_ips(LIST_OF_IPS)
     self.assertEqual(len(ips), 5000)