Files
netbox-librenms-plugin/netbox_librenms_plugin/tests/test_librenms_api_helpers.py
Vlastislav Svatek 673e67106e
Some checks failed
ci / deploy (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
first commit
2026-06-05 10:39:05 +02:00

27 lines
847 B
Python

"""Helper fixtures for LibreNMS API tests."""
from unittest.mock import patch
import pytest
@pytest.fixture(autouse=True)
def mock_librenms_config():
"""Auto-mock LibreNMS configuration for all API tests."""
with (
patch("netbox_librenms_plugin.librenms_api.get_plugin_config") as mock_config,
patch("netbox_librenms_plugin.models.LibreNMSSettings") as mock_settings,
):
# Default config
mock_config.return_value = {
"default": {
"librenms_url": "https://librenms.example.com",
"api_token": "test-token",
"cache_timeout": 300,
"verify_ssl": True,
}
}
mock_settings.objects.filter.return_value.first.return_value = None
yield {"mock_config": mock_config, "mock_settings": mock_settings}