import pytest
from unittest.mock import patch, MagicMock
from services import event_hooks

def test_on_order_created_hook():
    with patch('db.execute_query') as mock_query:
        # Arrange
        mock_query.return_value = [{"id": 99, "first_name": "Test", "email": "test@example.com"}]
        
        # Act
        # Should execute without throwing errors
        event_hooks.on_order_created(99)
        
        # Assert
        mock_query.assert_called_once_with("SELECT * FROM orders WHERE id = %s", (99,))

def test_on_order_status_changed_hook():
    order_data = {"id": 99, "first_name": "Test", "email": "test@example.com"}
    
    # Act
    # Should execute without throwing errors
    event_hooks.on_order_status_changed(order_id=99, status="completed", order_data=order_data, send_notification=True)
    
    # Can also test disabled notifications
    event_hooks.on_order_status_changed(order_id=99, status="shipped", order_data=order_data, send_notification=False)
