@@ -19,8 +19,7 @@ func TestHandler_AddNocX509Cert_SenderNotVendor(t *testing.T) {
19
19
addNocX509Cert := types .NewMsgAddNocX509Cert (setup .Trustee1 .String (), testconstants .NocCert1 )
20
20
_ , err := setup .Handler (setup .Ctx , addNocX509Cert )
21
21
22
- require .Error (t , err )
23
- require .True (t , sdkerrors .ErrUnauthorized .Is (err ))
22
+ require .ErrorIs (t , err , sdkerrors .ErrUnauthorized )
24
23
}
25
24
26
25
func TestHandler_AddNocX509Cert_AddNew (t * testing.T ) {
@@ -160,8 +159,7 @@ func TestHandler_AddNocX509Cert_Root_VID_Does_Not_Equal_To_AccountVID(t *testing
160
159
// try to add NOC certificate
161
160
nocX509Cert := types .NewMsgAddNocX509Cert (newAccAddress .String (), testconstants .NocCert1 )
162
161
_ , err := setup .Handler (setup .Ctx , nocX509Cert )
163
- require .Error (t , err )
164
- require .True (t , pkitypes .ErrCertVidNotEqualAccountVid .Is (err ))
162
+ require .ErrorIs (t , err , pkitypes .ErrCertVidNotEqualAccountVid )
165
163
}
166
164
167
165
func TestHandler_AddNocX509Cert_ForInvalidCertificate (t * testing.T ) {
@@ -174,8 +172,7 @@ func TestHandler_AddNocX509Cert_ForInvalidCertificate(t *testing.T) {
174
172
// add x509 certificate
175
173
addX509Cert := types .NewMsgAddNocX509Cert (accAddress .String (), testconstants .StubCertPem )
176
174
_ , err := setup .Handler (setup .Ctx , addX509Cert )
177
- require .Error (t , err )
178
- require .True (t , pkitypes .ErrInvalidCertificate .Is (err ))
175
+ require .ErrorIs (t , err , pkitypes .ErrInvalidCertificate )
179
176
}
180
177
181
178
func TestHandler_AddXNoc509Cert_ForNocRootCertificate (t * testing.T ) {
@@ -188,8 +185,7 @@ func TestHandler_AddXNoc509Cert_ForNocRootCertificate(t *testing.T) {
188
185
// try to add root certificate x509 certificate
189
186
addX509Cert := types .NewMsgAddX509Cert (accAddress .String (), testconstants .NocRootCert1 )
190
187
_ , err := setup .Handler (setup .Ctx , addX509Cert )
191
- require .Error (t , err )
192
- require .True (t , pkitypes .ErrInappropriateCertificateType .Is (err ))
188
+ require .ErrorIs (t , err , pkitypes .ErrNonRootCertificateSelfSigned )
193
189
}
194
190
195
191
func TestHandler_AddXNoc509Cert_ForRootNonNocCertificate (t * testing.T ) {
@@ -212,7 +208,6 @@ func TestHandler_AddXNoc509Cert_ForRootNonNocCertificate(t *testing.T) {
212
208
// try to add root certificate x509 certificate
213
209
addX509Cert := types .NewMsgAddNocX509Cert (accAddress .String (), testconstants .IntermediateCertWithVid1 )
214
210
_ , err := setup .Handler (setup .Ctx , addX509Cert )
215
- require .Error (t , err )
216
211
require .ErrorIs (t , err , pkitypes .ErrInappropriateCertificateType )
217
212
}
218
213
@@ -333,7 +328,7 @@ func TestHandler_AddNocX509Cert_CertificateExist(t *testing.T) {
333
328
Vid : testconstants .VendorID1 ,
334
329
},
335
330
nocCert : testconstants .NocCert1 ,
336
- err : pkitypes . ErrCertVidNotEqualAccountVid ,
331
+ err : sdkerrors . ErrUnauthorized ,
337
332
},
338
333
}
339
334
0 commit comments