Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/Arete-Consortium/ai-skills --skill mock명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | mock |
| description | Test Mock & Fixture Generator |
| lifecycle | experimental |
Generate mock objects, fixtures, and test data.
/mock ClassName # Generate mock for class
/mock path/to/module.py # Generate mocks for module
/mock --pytest # Pytest fixtures style
/mock --factory # Factory Boy style
import pytest
from unittest.mock import Mock, MagicMock, patch
@pytest.fixture
def mock_database():
"""Mock database connection."""
db = MagicMock()
db.query.return_value = [{"id": 1, "name": "Test"}]
db.insert.return_value = True
return db
@pytest.fixture
def mock_api_client():
"""Mock external API client."""
client = MagicMock()
client.get.return_value = {"status": "ok", "data": []}
client.post.return_value = {"id": 123}
return client
@pytest.fixture
def sample_user():
"""Sample user for testing."""
return {
"id": 1,
"username": "testuser",
"email": "test@example.com",
"created_at": "2024-01-01T00:00:00Z"
}
import factory
from factory import fuzzy
from myapp.models import User, Order
class UserFactory(factory.Factory):
class Meta:
model = User
id = factory.Sequence(lambda n: n)
username = factory.Faker('user_name')
email = factory.Faker('email')
created_at = factory.Faker('date_time')
class OrderFactory(factory.Factory):
class Meta:
model = Order
id = factory.Sequence(lambda n: n)
user = factory.SubFactory(UserFactory)
total = fuzzy.FuzzyDecimal(10.0, 1000.0)
status = fuzzy.FuzzyChoice(['pending', 'completed', 'cancelled'])
@pytest.fixture
def mock_external_services():
"""Patch all external service calls."""
with patch('myapp.services.api_client') as mock_api, \
patch('myapp.services.db_client') as mock_db, \
patch('myapp.services.cache') as mock_cache:
mock_api.get.return_value = {"data": []}
mock_db.query.return_value = []
mock_cache.get.return_value = None
yield {
'api': mock_api,
'db': mock_db,
'cache': mock_cache
}
mock.method.return_value = "result"
mock.method.side_effect = [1, 2, 3] # Sequential returns
mock.method.side_effect = ValueError("error") # Raise exception
mock.method.assert_called_once()
mock.method.assert_called_with(arg1, arg2)
mock.method.assert_not_called()
assert mock.method.call_count == 3
from unittest.mock import AsyncMock
@pytest.fixture
def mock_async_client():
client = AsyncMock()
client.fetch.return_value = {"data": []}
return client
When /mock is invoked: