mirror of
https://github.com/secynic/ipwhois.git
synced 2025-12-10 00:40:57 -06:00
100% Coverage
Added tests to make 100% code coverage again. Also updated coveragerc to show missing lines in the coverage report.
This commit is contained in:
parent
48619682d0
commit
aa2de4a3e1
@ -1,4 +1,5 @@
|
||||
[report]
|
||||
show_missing = True
|
||||
omit =
|
||||
*/python?.?/*
|
||||
*/site-packages/nose/*
|
||||
|
||||
@ -135,8 +135,30 @@ class TestIPASN(TestCommon):
|
||||
self.fail('Unexpected exception raised: {0}'.format(e))
|
||||
|
||||
def test_lookup(self):
|
||||
# TODO: need to modify asn.json for this.
|
||||
return NotImplemented
|
||||
data_dir = path.dirname(__file__)
|
||||
|
||||
with io.open(str(data_dir) + '/asn.json', 'r') as \
|
||||
data_file:
|
||||
data = json.load(data_file)
|
||||
|
||||
for key, val in data.items():
|
||||
|
||||
log.debug('Testing: {0}'.format(key))
|
||||
net = Net(key)
|
||||
obj = IPASN(net)
|
||||
|
||||
try:
|
||||
|
||||
self.assertIsInstance(obj.lookup(), dict)
|
||||
self.assertIsInstance(obj.lookup(asn_alts=['http']), dict)
|
||||
|
||||
except AssertionError as e:
|
||||
|
||||
raise e
|
||||
|
||||
except Exception as e:
|
||||
|
||||
self.fail('Unexpected exception raised: {0}'.format(e))
|
||||
|
||||
|
||||
class TestASNOrigin(TestCommon):
|
||||
|
||||
@ -45,6 +45,11 @@ class TestNIRWhois(TestCommon):
|
||||
inc_raw=True),
|
||||
dict)
|
||||
|
||||
self.assertIsInstance(obj.lookup(
|
||||
nir=val['nir'],
|
||||
response=val['response']),
|
||||
dict)
|
||||
|
||||
except AssertionError as e:
|
||||
|
||||
raise e
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user