forked from retoor/devplacepy
Add personal notes, DeepSearch history, backup offload, and gateway auth throttling
Also streamline the top navigation: drop the Tools dropdown, make Quizzes and Battles icon-only entries, and remove the Workspace, Containers and Editor entry points from the project detail page.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# retoor <retoor@molodetz.nl>
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user