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:
Haseeb Majid 2019-02-04 13:55:38 +00:00
parent 48619682d0
commit aa2de4a3e1
3 changed files with 30 additions and 2 deletions

View File

@ -1,4 +1,5 @@
[report]
show_missing = True
omit =
*/python?.?/*
*/site-packages/nose/*

View File

@ -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):

View File

@ -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