ai-agent/nlp/tests/test_intent.py

31 lines
No EOL
1.1 KiB
Python

"""Tests for NLP Intent Recognition Module"""
import unittest
from unittest.mock import patch
from nlp.intent import IntentRecognizer
class TestIntentRecognizer(unittest.TestCase):
"""Test cases for IntentRecognizer class"""
@patch('security.rbac_engine.verify_permission')
def test_analyze_with_permission(self, mock_verify):
"""Test analyze with proper RBAC permissions"""
mock_verify.return_value = True
recognizer = IntentRecognizer("test-model")
result = recognizer.analyze("test input")
self.assertIn("intent", result)
mock_verify.assert_called_with("nlp:analyze")
@patch('security.audit.log_operation')
def test_audit_logging(self, mock_log):
"""Test audit logging occurs during analysis"""
recognizer = IntentRecognizer("test-model")
recognizer.analyze("test input")
mock_log.assert_called()
def test_secure_decorator(self):
"""Test secure operation decorator"""
# Will be implemented after adding actual operations
pass
if __name__ == '__main__':
unittest.main()