Promene u dizajnu dokumenata, controla, residual graph, residual tabele...
This commit is contained in:
@@ -128,4 +128,45 @@ class UtilsTests(TestCase):
|
||||
|
||||
graph_data = generate_risk_graph(risks_with_controls)
|
||||
self.assertIsInstance(graph_data, str)
|
||||
self.assertTrue(len(graph_data) > 1000)
|
||||
self.assertTrue(len(graph_data) > 1000)
|
||||
|
||||
def test_generate_residual_risk_graph_base64(self):
|
||||
risks_with_controls = [
|
||||
{
|
||||
'risk': {'id': 1, 'name': 'Risk 1'},
|
||||
'residual_impact': 3,
|
||||
'residual_likelihood': 4,
|
||||
},
|
||||
{
|
||||
'risk': {'id': 2, 'name': 'Risk 2'},
|
||||
'residual_impact': 2,
|
||||
'residual_likelihood': 2,
|
||||
}
|
||||
]
|
||||
|
||||
graph_data = generate_residual_risk_graph(risks_with_controls)
|
||||
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},
|
||||
])
|
||||
Reference in New Issue
Block a user