def test_geoip_database_version(self): version = geoip.database_version() assert 'GeoIP' in version.keys() assert 'GeoIPASNum' in version.keys() assert len(version['GeoIP']['sha256']) == 64 assert isinstance(version['GeoIP']['timestamp'], float) assert len(version['GeoIPASNum']['sha256']) == 64 assert isinstance(version['GeoIPASNum']['timestamp'], float)
def test_geoip_database_version(self): maxmind_dir = os.path.join(self.config.resources_directory, 'maxmind-geoip') try: os.mkdir(maxmind_dir) except OSError: pass with open(os.path.join(maxmind_dir, 'GeoIP.dat'), 'w+') as f: f.write("XXX") with open(os.path.join(maxmind_dir, 'GeoIPASNum.dat'), 'w+') as f: f.write("XXX") version = geoip.database_version() assert 'GeoIP' in version.keys() assert 'GeoIPASNum' in version.keys() assert len(version['GeoIP']['sha256']) == 64 assert isinstance(version['GeoIP']['timestamp'], float) assert len(version['GeoIPASNum']['sha256']) == 64 assert isinstance(version['GeoIPASNum']['timestamp'], float) shutil.rmtree(maxmind_dir)