Add tests
This commit is contained in:
77
tests/conftest.py
Normal file
77
tests/conftest.py
Normal file
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
# Add the src directory to Python path
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src'))
|
||||
|
||||
import pytest
|
||||
from unittest.mock import Mock, MagicMock
|
||||
from kumacli.client import KumaClient
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_client():
|
||||
"""Create a mock KumaClient for testing"""
|
||||
client = Mock(spec=KumaClient)
|
||||
client.api = Mock()
|
||||
return client
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_monitors():
|
||||
"""Sample monitor data for testing"""
|
||||
return [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Test Monitor 1",
|
||||
"type": "http",
|
||||
"url": "https://example.com",
|
||||
"active": True,
|
||||
"parent": None
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Test Monitor 2",
|
||||
"type": "http",
|
||||
"url": "https://test.com",
|
||||
"active": False,
|
||||
"parent": None
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "Group Monitor",
|
||||
"type": "group",
|
||||
"active": True,
|
||||
"parent": None
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "Child Monitor",
|
||||
"type": "http",
|
||||
"url": "https://child.com",
|
||||
"active": False,
|
||||
"parent": 3
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_maintenances():
|
||||
"""Sample maintenance data for testing"""
|
||||
return [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Test Maintenance",
|
||||
"description": "Test maintenance description",
|
||||
"strategy": "single",
|
||||
"active": True
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Inactive Maintenance",
|
||||
"description": "Inactive maintenance description",
|
||||
"strategy": "single",
|
||||
"active": False
|
||||
}
|
||||
]
|
Reference in New Issue
Block a user