MCPcopy Create free account
hub / github.com/akash-network/node / TestCertHandlerRevokeCreateRevoked

Function TestCertHandlerRevokeCreateRevoked

x/cert/handler/handler_test.go:227–271  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

225}
226
227func TestCertHandlerRevokeCreateRevoked(t *testing.T) {
228 suite := setupTestSuite(t)
229
230 owner := testutil.AccAddress(t)
231 cert := testutil.Certificate(t, owner)
232
233 msgCreate := &types.MsgCreateCertificate{
234 Owner: owner.String(),
235 Cert: cert.PEM.Cert,
236 Pubkey: cert.PEM.Pub,
237 }
238
239 res, err := suite.handler(suite.ctx, msgCreate)
240 require.NoError(t, err)
241 require.NotNil(t, res)
242
243 resp, exists := suite.keeper.GetCertificateByID(suite.ctx, types.CertID{
244 Owner: owner,
245 Serial: cert.Serial,
246 })
247 require.True(t, exists)
248 testutil.CertificateRequireEqualResponse(t, cert, resp, types.CertificateValid)
249
250 msgRevoke := &types.MsgRevokeCertificate{
251 ID: types.ID{
252 Owner: owner.String(),
253 Serial: cert.Serial.String(),
254 },
255 }
256
257 res, err = suite.handler(suite.ctx, msgRevoke)
258 require.NoError(t, err)
259 require.NotNil(t, res)
260
261 resp, exists = suite.keeper.GetCertificateByID(suite.ctx, types.CertID{
262 Owner: owner,
263 Serial: cert.Serial,
264 })
265 require.True(t, exists)
266 testutil.CertificateRequireEqualResponse(t, cert, resp, types.CertificateRevoked)
267
268 res, err = suite.handler(suite.ctx, msgCreate)
269 require.Error(t, err, types.ErrCertificateExists.Error())
270 require.Nil(t, res)
271}
272
273func TestCertHandlerRevokeCreate(t *testing.T) {
274 suite := setupTestSuite(t)

Callers

nothing calls this directly

Calls 5

setupTestSuiteFunction · 0.70
GetCertificateByIDMethod · 0.65
ErrorMethod · 0.65
StringMethod · 0.45
handlerMethod · 0.45

Tested by

no test coverage detected