feat(add cache dir):

This commit is contained in:
Alexander Myasoedov
2025-12-09 19:51:47 +02:00
parent 9a4fb05491
commit b9dc5de708
9 changed files with 110 additions and 14 deletions
+18 -1
View File
@@ -1,6 +1,10 @@
import pytest
from agentic_security.http_spec import LLMSpec, parse_http_spec
from agentic_security.http_spec import (
InvalidHTTPSpecError,
LLMSpec,
parse_http_spec,
)
class TestParseHttpSpec:
@@ -55,6 +59,19 @@ class TestParseHttpSpec:
assert result.headers == {"Content-Type": "application/json"}
assert result.body == ""
def test_parse_http_spec_rejects_malformed_header(self):
http_spec = "GET http://example.com\nHeaderWithoutColon\n\n"
with pytest.raises(InvalidHTTPSpecError, match="Invalid header line"):
parse_http_spec(http_spec)
def test_parse_http_spec_trims_header_whitespace(self):
http_spec = "GET http://example.com\nAuthorization:Bearer token\n\n"
result = parse_http_spec(http_spec)
assert result.headers == {"Authorization": "Bearer token"}
class TestLLMSpec:
def test_validate_raises_error_for_missing_files(self):