예제 #1
0
    def test_get_alert_netflow_setup_ok(self, ossim_db_mock, _):
        ossim_db_mock.return_value.exec_query.return_value = self.alert_nf_db_result
        control_mgr = ControlManager(self.conf)

        res = control_mgr.get_alert_netflow_setup()
        self.assertEqual(
            res,
            dict(((i['conf'], i['value']) for i in self.alert_nf_db_result)))
예제 #2
0
    def test_get_alert_netflow_setup_db_err(self, ossim_db_mock, _):
        ossim_db_mock.return_value.exec_query.side_effect = DatabaseError('test err')
        control_mgr = ControlManager(self.conf)

        res = control_mgr.get_alert_netflow_setup()
        self.assertEqual(res, {})
        # check that it will return 0 by default
        self.assertEqual(0, res['udp_max_upload'])
        self.assertEqual(0, res['tcp_max_upload'])
예제 #3
0
    def test_get_alert_netflow_setup_db_err(self, ossim_db_mock, _):
        ossim_db_mock.return_value.exec_query.side_effect = DatabaseError(
            'test err')
        control_mgr = ControlManager(self.conf)

        res = control_mgr.get_alert_netflow_setup()
        self.assertEqual(res, {})
        # check that it will return 0 by default
        self.assertEqual(0, res['udp_max_upload'])
        self.assertEqual(0, res['tcp_max_upload'])
예제 #4
0
    def test_get_alert_netflow_setup_ok(self, ossim_db_mock, _):
        ossim_db_mock.return_value.exec_query.return_value = self.alert_nf_db_result
        control_mgr = ControlManager(self.conf)

        res = control_mgr.get_alert_netflow_setup()
        self.assertEqual(res, dict(((i['conf'], i['value']) for i in self.alert_nf_db_result)))