Deleted (7 files): - test_discovery.py, test_windsurf_integration.py (trivial assert True stubs) - pytest_simple.ini (unused --collect-only config) - conftest_path.py (duplicate of conftest.py path setup) - conftest_fixtures.py, conftest_full.py (unused conftest variants) Moved to integration/ (6 files): - test_blockchain_final.py, test_blockchain_nodes.py, test_blockchain_simple.py - test_basic_integration.py, test_integration_simple.py, test_working_integration.py Moved to fixtures/: - mock_blockchain_node.py tests/ root now has only conftest.py and README.md.
64 lines
1.8 KiB
Python
64 lines
1.8 KiB
Python
"""
|
|
Basic integration test to verify the test setup works
|
|
"""
|
|
|
|
import pytest
|
|
from unittest.mock import Mock
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_coordinator_client_fixture(coordinator_client):
|
|
"""Test that the coordinator_client fixture works"""
|
|
# Test that we can make a request
|
|
response = coordinator_client.get("/docs")
|
|
|
|
# Should succeed
|
|
assert response.status_code == 200
|
|
|
|
# Check it's the FastAPI docs
|
|
assert "swagger" in response.text.lower() or "openapi" in response.text.lower()
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_mock_coordinator_client():
|
|
"""Test with a fully mocked client"""
|
|
# Create a mock client
|
|
mock_client = Mock()
|
|
|
|
# Mock response
|
|
mock_response = Mock()
|
|
mock_response.status_code = 201
|
|
mock_response.json.return_value = {"job_id": "test-123", "status": "created"}
|
|
|
|
mock_client.post.return_value = mock_response
|
|
|
|
# Use the mock
|
|
response = mock_client.post("/v1/jobs", json={"test": "data"})
|
|
|
|
assert response.status_code == 201
|
|
assert response.json()["job_id"] == "test-123"
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_simple_job_creation_mock():
|
|
"""Test job creation with mocked dependencies"""
|
|
from unittest.mock import patch, Mock
|
|
from fastapi.testclient import TestClient
|
|
|
|
# Skip this test as it's redundant with the coordinator_client fixture tests
|
|
pytest.skip("Redundant test - already covered by fixture tests")
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_pytest_markings():
|
|
"""Test that pytest markings work"""
|
|
# This test should be collected as a unit test
|
|
assert True
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_pytest_markings_integration():
|
|
"""Test that integration markings work"""
|
|
# This test should be collected as an integration test
|
|
assert True
|