@@ -59,40 +59,52 @@ func TestCSRTemplate(t *testing.T) {
5959 testCases := map [string ]struct {
6060 File string
6161 CommonName string
62+ RequireIA bool
6263 Expected pkix.RDNSequence
6364 ErrAssertion assert.ErrorAssertionFunc
6465 }{
6566 "valid" : {
6667 File : "testdata/renew/ISD1-ASff00_0_111.csr.json" ,
68+ RequireIA : true ,
69+ Expected : wantSubject .ToRDNSequence (),
70+ ErrAssertion : assert .NoError ,
71+ },
72+ "valid - no ISD-AS" : {
73+ File : "testdata/renew/ISD1-ASff00_0_111.csr.json" ,
74+ RequireIA : false ,
6775 Expected : wantSubject .ToRDNSequence (),
6876 ErrAssertion : assert .NoError ,
6977 },
7078 "from chain" : {
7179 File : "testdata/renew/ISD1-ASff00_0_111.pem" ,
80+ RequireIA : true ,
7281 Expected : wantSubject .ToRDNSequence (),
7382 ErrAssertion : assert .NoError ,
7483 },
7584 "custom common name" : {
7685 File : "testdata/renew/ISD1-ASff00_0_111.csr.json" ,
7786 CommonName : "custom" ,
87+ RequireIA : true ,
7888 Expected : customSubject .ToRDNSequence (),
7989 ErrAssertion : assert .NoError ,
8090 },
8191 "custom common name from chain" : {
8292 File : "testdata/renew/ISD1-ASff00_0_111.pem" ,
8393 CommonName : "custom" ,
94+ RequireIA : true ,
8495 Expected : customSubject .ToRDNSequence (),
8596 ErrAssertion : assert .NoError ,
8697 },
8798 "no ISD-AS" : {
8899 File : "testdata/renew/no_isd_as.json" ,
100+ RequireIA : true ,
89101 ErrAssertion : assert .Error ,
90102 },
91103 }
92104 for name , tc := range testCases {
93105 t .Run (name , func (t * testing.T ) {
94106 t .Parallel ()
95- subject , err := createSubject (tc .File , tc .CommonName )
107+ subject , err := createSubject (tc .File , tc .CommonName , tc . RequireIA )
96108 tc .ErrAssertion (t , err )
97109 if err != nil {
98110 return
0 commit comments