MCPcopy Create free account
hub / github.com/crewjam/saml / TestClassify

Function TestClassify

errors_test.go:22–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20)
21
22func TestClassify(t *testing.T) {
23 assert.NilError(t, classify(nil, ErrInvalidSignature))
24
25 inner := errors.New("inner")
26 err := classify(inner, ErrInvalidSignature, ErrUntrustedCertificate)
27 assert.Error(t, err, "inner")
28 assert.Check(t, errors.Is(err, inner))
29 assert.Check(t, errors.Is(err, ErrInvalidSignature))
30 assert.Check(t, errors.Is(err, ErrUntrustedCertificate))
31 assert.Check(t, !errors.Is(err, ErrCertificateNotValidNow))
32
33 // InvalidResponseError exposes PrivateErr to errors.Is and errors.As
34 wrapped := &InvalidResponseError{PrivateErr: ErrBadStatus{Status: "urn:oasis:names:tc:SAML:2.0:status:Requester"}}
35 var badStatus ErrBadStatus
36 assert.Check(t, errors.As(wrapped, &badStatus))
37 assert.Equal(t, "urn:oasis:names:tc:SAML:2.0:status:Requester", badStatus.Status)
38}
39
40func TestClassifyCertificate(t *testing.T) {
41 idpCert := mustParseCertificate(golden.Get(t, "idp_cert.pem"))

Callers

nothing calls this directly

Calls 3

classifyFunction · 0.85
NewMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected