...

Source file src/github.com/letsencrypt/boulder/linter/lints/cpcps/lint_crl_has_no_cert_issuers_test.go

Documentation: github.com/letsencrypt/boulder/linter/lints/cpcps

     1  package cpcps
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  	"testing"
     7  
     8  	"github.com/zmap/zlint/v3/lint"
     9  
    10  	"github.com/letsencrypt/boulder/linter/lints/test"
    11  )
    12  
    13  func TestCrlHasNoCertIssuers(t *testing.T) {
    14  	t.Parallel()
    15  
    16  	testCases := []struct {
    17  		name       string
    18  		want       lint.LintStatus
    19  		wantSubStr string
    20  	}{
    21  		{
    22  			name: "good",
    23  			want: lint.Pass,
    24  		},
    25  		{
    26  			name: "cert_issuer",
    27  			want: lint.Notice,
    28  		},
    29  	}
    30  
    31  	for _, tc := range testCases {
    32  		t.Run(tc.name, func(t *testing.T) {
    33  			l := NewCrlHasNoCertIssuers()
    34  			c := test.LoadPEMCRL(t, fmt.Sprintf("testdata/crl_%s.pem", tc.name))
    35  			r := l.Execute(c)
    36  
    37  			if r.Status != tc.want {
    38  				t.Errorf("expected %q, got %q", tc.want, r.Status)
    39  			}
    40  			if !strings.Contains(r.Details, tc.wantSubStr) {
    41  				t.Errorf("expected %q, got %q", tc.wantSubStr, r.Details)
    42  			}
    43  		})
    44  	}
    45  }
    46  

View as plain text