Swaped from CIS to NIST controls
This commit is contained in:
@@ -45,7 +45,7 @@ class UtilsTests(TestCase):
|
||||
primary_impact="Financial"
|
||||
)
|
||||
|
||||
self.controls = [Control.objects.create(id=i, name=f"Control {i}") for i in range(1, 11)]
|
||||
self.controls = [Control.objects.create(id=i, subcategory=f"C-{i}", function=f"Control {i}") for i in range(1, 11)]
|
||||
|
||||
def test_extract_organization_details(self):
|
||||
details = extract_organization_details(self.organization)
|
||||
@@ -148,25 +148,25 @@ class UtilsTests(TestCase):
|
||||
self.assertIsInstance(graph_data, str)
|
||||
self.assertTrue(len(graph_data) > 1000)
|
||||
|
||||
def test_get_safeguard_summary_table_basic(self):
|
||||
from backend.core.tables import get_safeguard_summary_table
|
||||
risks_with_controls = [
|
||||
{
|
||||
'risk': {'id': 1, 'name': 'Risk 1'},
|
||||
'controls': [
|
||||
{'control': 101, 'control__name': 'Control A'},
|
||||
{'control': 102, 'control__name': 'Control B'},
|
||||
]
|
||||
},
|
||||
{
|
||||
'risk': {'id': 2, 'name': 'Risk 2'},
|
||||
'controls': [
|
||||
{'control': 101, 'control__name': 'Control A'},
|
||||
]
|
||||
}
|
||||
]
|
||||
summary = get_safeguard_summary_table(risks_with_controls)
|
||||
self.assertEqual(summary, [
|
||||
{'id': 101, 'name': 'Control A', 'count': 2},
|
||||
{'id': 102, 'name': 'Control B', 'count': 1},
|
||||
])
|
||||
def test_get_safeguard_summary_table_basic(self):
|
||||
from backend.core.tables import get_safeguard_summary_table
|
||||
risks_with_controls = [
|
||||
{
|
||||
'risk': {'id': 1, 'name': 'Risk 1'},
|
||||
'controls': [
|
||||
{'control': 101, 'control__subcategory': 'PR.AA-01', 'control__function': 'Identity'},
|
||||
{'control': 102, 'control__subcategory': 'PR.DS-11', 'control__function': 'Backups'},
|
||||
]
|
||||
},
|
||||
{
|
||||
'risk': {'id': 2, 'name': 'Risk 2'},
|
||||
'controls': [
|
||||
{'control': 101, 'control__subcategory': 'PR.AA-01', 'control__function': 'Identity'},
|
||||
]
|
||||
}
|
||||
]
|
||||
summary = get_safeguard_summary_table(risks_with_controls)
|
||||
self.assertEqual(summary, [
|
||||
{'id': 101, 'subcategory': '', 'category': '', 'function': '', 'name': 'PR.AA-01 - Identity', 'count': 2},
|
||||
{'id': 102, 'subcategory': '', 'category': '', 'function': '', 'name': 'PR.DS-11 - Backups', 'count': 1},
|
||||
])
|
||||
Reference in New Issue
Block a user