mock-settings-manager

Switch mock service profiles for testing failure scenarios without code changes.

Updated May 11, 2026
One-click install
npx skills add https://github.com/thachrocky12345/local-agent-train-workstation --skill mock-settings-manager-thachrocky12345
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mock-settings-manager
Source: https://github.com/thachrocky12345/local-agent-train-workstation/tree/main/.claude/skills/mock-settings-manager
Command: npx skills add https://github.com/thachrocky12345/local-agent-train-workstation --skill mock-settings-manager-thachrocky12345

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Testing error paths like payment declines, video failures, and service timeouts normally requires code edits or manual stubbing. This Skill lets you switch between predefined mock configurations at runtime so QA and developers can test failure modes without touching application code. ## Core Features & Use Cases - Profile-Based Mock Switching: Load JSON profiles (default, payment-failures, video-degraded, offline, rate-limited, crisis-flow) that set failure modes for Twilio, Stripe, SendGrid, Azure Search, Sterling, Certn, and ipapi via a Django management command backed by Redis cache. - Per-Service Overrides: Override individual services on top of any profile, e.g. set stripe=card_declined while keeping everything else on the happy path. - Runtime Header Switching: A DEBUG-only middleware applies mock profiles per-request via the X-Mock-Profile HTTP header, plus a frontend script that syncs profiles to MSW environment files. - Use Case: A QA engineer needs to demo error handling to stakeholders. They run the payment-failures profile, then validate all profiles before a test session to catch misconfigured failure modes. ## Quick Start Ask the assistant to switch the mock profile to payment-failures so Stripe returns declined cards during testing.

Frequently Asked Questions about mock-settings-manager

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I switch mock profiles for testing failure scenarios?

Run the set_mock_profile Django management command with a profile name, such as payment-failures or offline. The profile is loaded from a JSON file in test_profiles and stored in the Redis-backed Django cache, where mock services read their configured failure modes.

How to override a single service failure mode in a mock profile?

Use the --override flag with service=mode pairs, for example --override stripe=card_declined twilio=timeout. Overrides apply on top of the selected profile, leaving all other services at their profile defaults, and are validated against the allowed modes per service.

Can I change mock behavior per HTTP request without restarting?

Yes, the MockProfileMiddleware reads the X-Mock-Profile header and applies the profile per request with a 5-minute cache timeout. It only activates when Django DEBUG is True, so it is silently disabled in production.

Why does the mock profile command fail when Redis is down?

The command stores profiles via django.core.cache, which is backed by Redis in the Docker setup. If Redis is unavailable, cache operations fail; in tests, autouse mock_cache fixtures replace the cache with a MagicMock to avoid this dependency.

What are the limitations of profile-based mock switching?

Profiles only control services with implemented mock classes, so the mock-external-services skill must be set up first. Header-based switching is dev-only, and frontend switching requires MSW to be installed and configured separately.