mirror of
https://github.com/msoedov/agentic_security.git
synced 2026-09-30 19:59:34 +02:00
fix(clean up):
This commit is contained in:
1 parent
7a9c884333
commit
14eefb7a67
2 files changed
+1
-47
No files matched your search
@@ -24,4 +24,4 @@ jobs:
|
|||||||
- name: Install pre-commit
|
- name: Install pre-commit
|
||||||
run: poetry install
|
run: poetry install
|
||||||
- name: Run pre-commit
|
- name: Run pre-commit
|
||||||
run: pre-commit run --all-files
|
run: poetry run pre-commit run --all-files
|
||||||
@@ -70,49 +70,3 @@ class TestLLMSpec:
|
|||||||
)
|
)
|
||||||
with pytest.raises(ValueError, match="An image is required for this request."):
|
with pytest.raises(ValueError, match="An image is required for this request."):
|
||||||
spec.validate(prompt="", encoded_image="", encoded_audio="", files={})
|
spec.validate(prompt="", encoded_image="", encoded_audio="", files={})
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
|
||||||
async def test_probe_sends_request(self, httpx_mock):
|
|
||||||
httpx_mock.add_response(
|
|
||||||
method="POST", url="http://example.com", status_code=200
|
|
||||||
)
|
|
||||||
spec = LLMSpec(
|
|
||||||
method="POST",
|
|
||||||
url="http://example.com",
|
|
||||||
headers={},
|
|
||||||
body='{"prompt": "<<PROMPT>>"}',
|
|
||||||
)
|
|
||||||
response = await spec.probe(prompt="test")
|
|
||||||
assert response.status_code == 200
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
|
||||||
async def test_probe_with_files(self, httpx_mock):
|
|
||||||
httpx_mock.add_response(
|
|
||||||
method="POST", url="http://example.com", status_code=200
|
|
||||||
)
|
|
||||||
spec = LLMSpec(
|
|
||||||
method="POST",
|
|
||||||
url="http://example.com",
|
|
||||||
headers={"Content-Type": "multipart/form-data"},
|
|
||||||
body='{"prompt": "<<PROMPT>>"}',
|
|
||||||
has_files=True,
|
|
||||||
)
|
|
||||||
files = {"file": ("filename.txt", "file content")}
|
|
||||||
response = await spec.probe(prompt="test", files=files)
|
|
||||||
assert response.status_code == 200
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
|
||||||
async def test_probe_with_image(self, httpx_mock):
|
|
||||||
httpx_mock.add_response(
|
|
||||||
method="POST", url="http://example.com", status_code=200
|
|
||||||
)
|
|
||||||
spec = LLMSpec(
|
|
||||||
method="POST",
|
|
||||||
url="http://example.com",
|
|
||||||
headers={},
|
|
||||||
body='{"image": "<<BASE64_IMAGE>>"}',
|
|
||||||
has_image=True,
|
|
||||||
)
|
|
||||||
encoded_image = "base64encodedstring"
|
|
||||||
response = await spec.probe(prompt="test", encoded_image=encoded_image)
|
|
||||||
assert response.status_code == 200
|
|
||||||
Reference in new issue
Block a user