fix: correct CI workflow paths for depcheck project
This commit is contained in:
@@ -11,7 +11,7 @@ from depcheck.models import Dependency, PackageManager, ScanResult, Severity, Vu
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def temp_dir():
|
def temp_dir():
|
||||||
"""Create a temporary directory for tests."""
|
"""Create a temporary directory."""
|
||||||
with tempfile.TemporaryDirectory() as tmpdir:
|
with tempfile.TemporaryDirectory() as tmpdir:
|
||||||
yield tmpdir
|
yield tmpdir
|
||||||
|
|
||||||
@@ -135,103 +135,3 @@ def sample_outdated_dependencies():
|
|||||||
def empty_scan_result():
|
def empty_scan_result():
|
||||||
"""Create an empty scan result."""
|
"""Create an empty scan result."""
|
||||||
return ScanResult()
|
return ScanResult()
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def sample_request():
|
|
||||||
"""Create a sample recorded request."""
|
|
||||||
from api_snapshot.recorder.recorder import RecordedRequest
|
|
||||||
return RecordedRequest(
|
|
||||||
method="GET",
|
|
||||||
url="https://api.example.com/users",
|
|
||||||
headers={"Accept": "application/json"},
|
|
||||||
body=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def sample_response():
|
|
||||||
"""Create a sample recorded response."""
|
|
||||||
from api_snapshot.recorder.recorder import RecordedResponse
|
|
||||||
return RecordedResponse(
|
|
||||||
status_code=200,
|
|
||||||
headers={"Content-Type": "application/json"},
|
|
||||||
body='{"success": true}',
|
|
||||||
latency_ms=150,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def sample_pair(sample_request, sample_response):
|
|
||||||
"""Create a sample request-response pair."""
|
|
||||||
from api_snapshot.recorder.recorder import RequestResponsePair
|
|
||||||
return RequestResponsePair(
|
|
||||||
request=sample_request,
|
|
||||||
response=sample_response,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def sample_snapshot(sample_pair):
|
|
||||||
"""Create a sample snapshot."""
|
|
||||||
from api_snapshot.snapshot.manager import Snapshot, SnapshotMetadata
|
|
||||||
meta = SnapshotMetadata(description="Test snapshot")
|
|
||||||
return Snapshot(metadata=meta, requests=[sample_pair])
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def sample_snapshot_dict():
|
|
||||||
"""Create a sample snapshot dictionary."""
|
|
||||||
return {
|
|
||||||
"metadata": {
|
|
||||||
"version": "1.0",
|
|
||||||
"timestamp": "2024-01-01T00:00:00",
|
|
||||||
"description": "Test snapshot",
|
|
||||||
"source_url": "https://api.example.com",
|
|
||||||
"latency_mode": "original",
|
|
||||||
"custom_latency_ms": None,
|
|
||||||
"tags": []
|
|
||||||
},
|
|
||||||
"requests": [
|
|
||||||
{
|
|
||||||
"request": {
|
|
||||||
"method": "GET",
|
|
||||||
"url": "https://api.example.com/users",
|
|
||||||
"headers": {"Accept": "application/json"},
|
|
||||||
"body": None,
|
|
||||||
"timestamp": "2024-01-01T00:00:00"
|
|
||||||
},
|
|
||||||
"response": {
|
|
||||||
"status_code": 200,
|
|
||||||
"headers": {"Content-Type": "application/json"},
|
|
||||||
"body": '{"success": true}',
|
|
||||||
"latency_ms": 150
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def snapshot_manager(temp_dir):
|
|
||||||
"""Create a snapshot manager with a test snapshot."""
|
|
||||||
from api_snapshot.snapshot.manager import SnapshotManager
|
|
||||||
manager = SnapshotManager(temp_dir)
|
|
||||||
return manager
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def snapshot_file(temp_dir, sample_pair):
|
|
||||||
"""Create a snapshot file for testing."""
|
|
||||||
from api_snapshot.snapshot.manager import SnapshotManager
|
|
||||||
import json
|
|
||||||
|
|
||||||
manager = SnapshotManager(temp_dir)
|
|
||||||
manager.save_snapshot(
|
|
||||||
name="test_snapshot",
|
|
||||||
requests=[sample_pair, sample_pair],
|
|
||||||
description="Test snapshot"
|
|
||||||
)
|
|
||||||
|
|
||||||
path = manager._get_path("test_snapshot")
|
|
||||||
return path
|
|
||||||
|
|||||||
Reference in New Issue
Block a user