(t *testing.T)
| 98 | } |
| 99 | |
| 100 | func TestCertHandlerCreateOwnerMismatch(t *testing.T) { |
| 101 | suite := setupTestSuite(t) |
| 102 | |
| 103 | owner := testutil.AccAddress(t) |
| 104 | cert := testutil.Certificate(t, owner) |
| 105 | |
| 106 | msg := &types.MsgCreateCertificate{ |
| 107 | Owner: testutil.AccAddress(t).String(), |
| 108 | Cert: cert.PEM.Cert, |
| 109 | Pubkey: cert.PEM.Pub, |
| 110 | } |
| 111 | |
| 112 | res, err := suite.handler(suite.ctx, msg) |
| 113 | require.Error(t, err, types.ErrInvalidCertificateValue.Error()) |
| 114 | require.Nil(t, res) |
| 115 | |
| 116 | _, exists := suite.keeper.GetCertificateByID(suite.ctx, types.CertID{ |
| 117 | Owner: owner, |
| 118 | Serial: cert.Serial, |
| 119 | }) |
| 120 | require.False(t, exists) |
| 121 | |
| 122 | _, exists = suite.keeper.GetCertificateByID(suite.ctx, types.CertID{ |
| 123 | Owner: owner, |
| 124 | }) |
| 125 | require.False(t, exists) |
| 126 | } |
| 127 | |
| 128 | func TestCertHandlerDuplicate(t *testing.T) { |
| 129 | suite := setupTestSuite(t) |
nothing calls this directly
no test coverage detected