Fully autonomous AI Agents system capable of performing complex penetration testing tasks
Go ai-agentsai-security-toolanthropicautonomous-agentsgolanggptgraphqlmulti-agent-systemoffensive-securityopen-sourceopenaipenetration-testingpenetration-testing-toolsreactsecurity-automationsecurity-testingsecurity-toolsself-hosted
test: add failure-path coverage for schema validation
mason50528ddc25f4116b
diff --git a/backend/pkg/schema/schema_test.go b/backend/pkg/schema/schema_test.goindex 27c7d2a4..43b301b8 100644--- a/backend/pkg/schema/schema_test.go+++ b/backend/pkg/schema/schema_test.go@@ -56,6 +56,11 @@ func TestSchemaValid(t *testing.T) {schema: Schema{Type: Type{Type: "number"}},wantErr: false,},+ {+ name: "invalid schema with bad ref",+ schema: Schema{Type: Type{Ref: "not-a-valid-ref-uri\x00"}},+ wantErr: true,+ },}for _, tt := range tests {@@ -94,6 +99,15 @@ func TestSchemaGetValidator(t *testing.T) {require.NoError(t, err)assert.NotNil(t, v)})++ t.Run("invalid schema with bad ref fails", func(t *testing.T) {+ t.Parallel()+ s := Schema{+ Type: Type{Ref: "not-a-valid-ref-uri\x00"},+ }+ _, err := s.GetValidator()+ assert.Error(t, err)+ })}func TestSchemaValidateString(t *testing.T) {@@ -158,6 +172,12 @@ func TestSchemaValidateBytes(t *testing.T) {require.NoError(t, err)assert.False(t, result.Valid())})++ t.Run("malformed json", func(t *testing.T) {+ t.Parallel()+ _, err := intSchema.ValidateBytes([]byte("{invalid json"))+ assert.Error(t, err)+ })}func TestSchemaValidateGo(t *testing.T) {