2016-07-25 18:48:08 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
from pytaxonomies import Taxonomies
|
|
|
|
|
|
|
|
|
|
|
|
class TestPyTaxonomies(unittest.TestCase):
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
self.taxonomies = Taxonomies()
|
|
|
|
|
|
|
|
def test_print(self):
|
|
|
|
print(self.taxonomies)
|
|
|
|
|
2016-07-25 19:38:17 +02:00
|
|
|
def test_expanded_print(self):
|
2016-07-26 10:32:46 +02:00
|
|
|
for name in self.taxonomies.keys():
|
2016-07-25 19:38:17 +02:00
|
|
|
tax = self.taxonomies.get(name)
|
2016-07-26 10:34:57 +02:00
|
|
|
print(tax.machinetags_expanded())
|
2016-07-25 19:38:17 +02:00
|
|
|
|
|
|
|
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")
|
|
|
|
|
2016-07-26 10:56:40 +02:00
|
|
|
def test_print_classes(self):
|
|
|
|
tax = list(self.taxonomies.values())[0]
|
|
|
|
print(tax)
|
|
|
|
pred = list(tax.values())[0]
|
|
|
|
print(pred)
|
|
|
|
entry = list(pred.values())[0]
|
|
|
|
print(entry)
|
|
|
|
|
2016-07-25 19:38:17 +02:00
|
|
|
|
2016-07-25 18:48:08 +02:00
|
|
|
if __name__ == "__main__":
|
|
|
|
unittest.main()
|