PyTaxonomies/tests/tests.py

47 lines
1.2 KiB
Python
Raw Normal View History

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()
2016-07-28 11:56:02 +02:00
self.taxonomies_offline = Taxonomies(manifest_path="./misp-taxonomies/MANIFEST.json")
2016-07-25 18:48:08 +02:00
2016-07-28 11:56:02 +02:00
def test_compareOnlineOffilne(self):
self.assertEqual(str(self.taxonomies), str(self.taxonomies_offline))
2016-07-25 18:48:08 +02:00
2016-07-28 11:56:02 +02:00
def test_expanded_machinetags(self):
self.taxonomies.all_machinetags(expanded=True)
2016-07-25 19:38:17 +02:00
2016-07-28 11:56:02 +02:00
def test_machinetags(self):
self.taxonomies.all_machinetags()
2016-07-25 19:38:17 +02:00
2016-07-28 11:56:02 +02:00
def test_dict(self):
len(self.taxonomies)
2016-07-25 19:38:17 +02:00
for n, t in self.taxonomies.items():
len(t)
for p, value in t.items():
continue
2016-07-28 11:56:02 +02:00
def test_search(self):
self.taxonomies.search('phish')
def test_search_expanded(self):
self.taxonomies.search('phish', expanded=True)
2016-07-25 19:38:17 +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()