# retoor from devplacepy.services import ai_modifier, correction class _FakeResponse: def __init__(self, content: str) -> None: self._content = content self.headers: dict = {} def raise_for_status(self) -> None: return None def json(self) -> dict: return {"choices": [{"message": {"content": self._content}}]} class _FakeClient: def __init__(self) -> None: self.calls: list[dict] = [] def post(self, url, json=None, headers=None, timeout=None): self.calls.append({"url": url, "json": json, "headers": headers}) return _FakeResponse("modified text") def test_modify_text_requests_the_preamble_bypass(local_db, monkeypatch): fake = _FakeClient() monkeypatch.setattr(correction, "_client", lambda: fake) ai_modifier.modify_text("user-api-key", "", "@ai fix this") sent = fake.calls[-1] assert sent["json"]["bypass_preamble"] is True