MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / TestHasValidSignature

Function TestHasValidSignature

internal/cache/signature_cache_test.go:321–344  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

319}
320
321func TestHasValidSignature(t *testing.T) {
322 tests := []struct {
323 name string
324 modelName string
325 signature string
326 expected bool
327 }{
328 {"valid long signature", testModelName, "abc123validSignature1234567890123456789012345678901234567890", true},
329 {"exactly 50 chars", testModelName, "12345678901234567890123456789012345678901234567890", true},
330 {"49 chars - invalid", testModelName, "1234567890123456789012345678901234567890123456789", false},
331 {"empty string", testModelName, "", false},
332 {"short signature", testModelName, "abc", false},
333 {"gemini sentinel", "gemini-3-pro-preview", "skip_thought_signature_validator", true},
334 }
335
336 for _, tt := range tests {
337 t.Run(tt.name, func(t *testing.T) {
338 result := HasValidSignature(tt.modelName, tt.signature)
339 if result != tt.expected {
340 t.Errorf("HasValidSignature(%q) = %v, expected %v", tt.signature, result, tt.expected)
341 }
342 })
343 }
344}
345
346func TestCacheSignature_TextHashCollisionResistance(t *testing.T) {
347 ClearSignatureCache("")

Callers

nothing calls this directly

Calls 2

HasValidSignatureFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected