Tests: Convert test_get_all_mitigations() from unittest to pytest

This commit is contained in:
Mike Salvatore 2021-07-19 12:26:32 -04:00
parent ac9bd8dee7
commit f0033d0c7c
1 changed files with 8 additions and 11 deletions

View File

@ -1,14 +1,11 @@
from unittest import TestCase
from monkey_island.cc.services.attack.mitre_api_interface import MitreApiInterface from monkey_island.cc.services.attack.mitre_api_interface import MitreApiInterface
class TestMitreApiInterface(TestCase): def test_get_all_mitigations():
def test_get_all_mitigations(self): mitigations = MitreApiInterface.get_all_mitigations()
mitigations = MitreApiInterface.get_all_mitigations() assert len(mitigations.items()) >= 282
self.assertIsNotNone((len(mitigations.items()) >= 282)) mitigation = next(iter(mitigations.values()))
mitigation = next(iter(mitigations.values())) assert mitigation["type"] == "course-of-action"
self.assertEqual(mitigation["type"], "course-of-action") assert mitigation["name"] is not None
self.assertIsNotNone(mitigation["name"]) assert mitigation["description"] is not None
self.assertIsNotNone(mitigation["description"]) assert mitigation["external_references"] is not None
self.assertIsNotNone(mitigation["external_references"])