Commit 9bec82b1 by William Tisäter

Increase test coverage

parent da3be8ac
......@@ -17,11 +17,6 @@ class TestGenerals(unittest.TestCase):
assert len(const.COUNTRY_CODES) == len(const.COUNTRY_NAMES)
assert len(const.COUNTRY_CODES) == len(const.CONTINENT_NAMES)
def testMetaclass(self):
a = pygeoip.GeoIP(filename=COUNTRY_DB_PATH)
b = pygeoip.GeoIP(filename=COUNTRY_DB_PATH)
assert a is b
@raises(pygeoip.GeoIPError)
def testCorruptDatabase(self):
gi = pygeoip.GeoIP(filename=CORRUPT_DB_PATH)
......
# -*- coding: utf-8 -*-
import unittest
from nose.tools import raises
import pygeoip
from tests.config import ASNUM_DB_PATH
......@@ -30,3 +31,11 @@ class TestGeoIPASNumFunctions(unittest.TestCase):
self.assertEqual(gb_as, self.gb_as)
self.assertEqual(us_as, self.us_as)
@raises(pygeoip.GeoIPError)
def testCodeByAddr(self):
self.gia.country_code_by_addr(self.us_ip)
@raises(pygeoip.GeoIPError)
def testNameByAddr(self):
self.gia.country_name_by_addr(self.us_ip)
......@@ -75,3 +75,19 @@ class TestGeoIPCountryFunctions(unittest.TestCase):
def testOpen6With4(self):
data = self.gi6.country_code_by_addr(self.gb_ip)
raise ValueError(data)
@raises(pygeoip.GeoIPError)
def testOrgByAddr(self):
self.gi.org_by_addr(self.us_ip)
@raises(pygeoip.GeoIPError)
def testRecordByAddr(self):
self.gi.record_by_addr(self.us_ip)
@raises(pygeoip.GeoIPError)
def testRegionByAddr(self):
self.gi.region_by_addr(self.us_ip)
@raises(pygeoip.GeoIPError)
def testTimeZoneByAddr(self):
self.gi.time_zone_by_addr(self.us_ip)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment