Beispiel #1
0
def test_resolution():
    """Test address resolution with few random IP addrs"""
    conf = ConfReader('test/testconf.ini')
    geodb = GeoIP.open("GeoLiteCity.dat", GeoIP.GEOIP_MEMORY_CACHE)
    r = Resolver(geodb, conf)
    assert r._georesolve('') == None
    assert r._georesolve('3.3.3.3') == (('38.00', '-97.00', 'United States', ''), 1)
    assert r._georesolve('8.8.8.8') == (('37.42', '-122.06', 'United States', ''), 1)
    assert r._georesolve('88.88.88.88') == (('58.85', '5.73', 'Norway', ''), 1)
Beispiel #2
0
def test_file_fetch():
    """Test fetching IP addrs from file"""
    conf = ConfReader('test/testconf.ini')
    r = Resolver(None, conf)
    assert r._file_fetch()[1] == ['1.1.1.1', '8.8.8.8', '88.88.88.88']