This commit is contained in:
Nitzan Pomerantz
2025-10-30 18:26:48 +02:00
parent ae7f7f51c5
commit 04a1e68604
13 changed files with 1870 additions and 2 deletions
+35 -1
View File
@@ -4,6 +4,7 @@ Pytest configuration for nadlan_mcp tests.
import pytest
from unittest.mock import Mock
from tests.vcr_config import my_vcr
@pytest.fixture
@@ -57,4 +58,37 @@ def sample_deals_response():
"neighborhood": "test neighborhood"
}
]
}
}
@pytest.fixture
def vcr_cassette(request):
"""
Fixture that provides VCR cassette for recording/replaying HTTP interactions.
Usage:
def test_something(vcr_cassette):
with vcr_cassette:
# Make HTTP calls here
response = requests.get("...")
"""
# Generate cassette name from test name
test_name = request.node.name
cassette_name = f"{request.module.__name__}.{test_name}"
return my_vcr.use_cassette(cassette_name)
@pytest.fixture
def vcr_enabled():
"""
Fixture that enables VCR for the entire test function.
Usage:
@pytest.mark.usefixtures('vcr_enabled')
def test_something():
# All HTTP calls automatically recorded/replayed
response = requests.get("...")
"""
# This is handled by pytest-vcr plugin or manual context manager
pass