mirror of https://github.com/MISP/PyTaxonomies
Improve coverage
parent
f8e7bcc1ff
commit
1f6370a2d7
|
@ -12,6 +12,7 @@ install:
|
|||
- pip install coveralls
|
||||
- pip install codecov
|
||||
- pip install .
|
||||
- git clone https://github.com/MISP/misp-taxonomies.git
|
||||
|
||||
script:
|
||||
- nosetests --with-coverage --cover-package=pytaxonomies
|
||||
|
|
|
@ -106,6 +106,8 @@ class Taxonomies(collections.Mapping):
|
|||
|
||||
if manifest_path:
|
||||
self.url = os.path.dirname(os.path.realpath(manifest_path))
|
||||
else:
|
||||
self.url = self.manifest['url']
|
||||
self.version = self.manifest['version']
|
||||
self.license = self.manifest['license']
|
||||
self.description = self.manifest['description']
|
||||
|
@ -120,7 +122,7 @@ class Taxonomies(collections.Mapping):
|
|||
return requests.get(url).json()
|
||||
|
||||
def __make_uri(self, taxonomy_name):
|
||||
return '{}{}/{}'.format(self.manifest['url'], taxonomy_name, self.manifest['path'])
|
||||
return '{}/{}/{}'.format(self.url, taxonomy_name, self.manifest['path'])
|
||||
|
||||
def __init_taxonomies(self):
|
||||
self.taxonomies = {}
|
||||
|
|
|
@ -13,5 +13,24 @@ class TestPyTaxonomies(unittest.TestCase):
|
|||
def test_print(self):
|
||||
print(self.taxonomies)
|
||||
|
||||
def test_expanded_print(self):
|
||||
for name in self.taxonomies.taxonomies_names:
|
||||
tax = self.taxonomies.get(name)
|
||||
print(tax.print_expanded_entries())
|
||||
|
||||
def test_len(self):
|
||||
len(self.taxonomies)
|
||||
|
||||
def test_iter(self):
|
||||
for n, t in self.taxonomies.items():
|
||||
len(t)
|
||||
t.amount_entries()
|
||||
for p, value in t.items():
|
||||
continue
|
||||
|
||||
def test_local(self):
|
||||
Taxonomies(manifest_path="./misp-taxonomies/MANIFEST.json")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue