Add Memory Gateway agent plugin
This commit is contained in:
24
plugins/memory-gateway-agent/tests/test_output_redaction.py
Normal file
24
plugins/memory-gateway-agent/tests/test_output_redaction.py
Normal file
@ -0,0 +1,24 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from memory_gateway_plugin.output import dumps_safe, redact, short_id
|
||||
|
||||
|
||||
def test_output_redaction_hides_secret_fields():
|
||||
payload = {
|
||||
"api_key": "sk-test",
|
||||
"headers": {"Authorization": "Bearer abc"},
|
||||
"nested": {"cookie": "sid=abc"},
|
||||
"safe": "value",
|
||||
}
|
||||
|
||||
text = dumps_safe(payload)
|
||||
|
||||
assert "sk-test" not in text
|
||||
assert "Bearer abc" not in text
|
||||
assert "sid=abc" not in text
|
||||
assert "value" in text
|
||||
assert redact("password=abc") == "<redacted>"
|
||||
|
||||
|
||||
def test_output_redaction_shortens_memory_ids():
|
||||
assert short_id("mem_1234567890abcdef") == "mem_1234...cdef"
|
||||
Reference in New Issue
Block a user