Skip to content

Commit

Permalink
fix: ut
Browse files Browse the repository at this point in the history
  • Loading branch information
constwz committed Jul 11, 2024
1 parent 3f3e626 commit 3500eec
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion x/storage/keeper/cross_app_permission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ func (s *TestSuite) TestSynCreatePolicyByMsgErr() {
serializedSynPackage = append([]byte{storageTypes.OperationCreatePolicy}, serializedSynPackage...)

// case 1: bucket not found
storageKeeper.EXPECT().GetBucketInfoById(gomock.Any(), gomock.Any()).Return(&storageTypes.BucketInfo{
Owner: op.String(),
BucketName: "test-bucket",
}, false).AnyTimes()
storageKeeper.EXPECT().GetResourceOwnerAndIdFromGRN(gomock.Any(), gomock.Any()).Return(op, resourceIds[0], storageTypes.ErrNoSuchBucket.Wrapf("bucketName: test-bucket")).AnyTimes()
res := app.ExecuteSynPackage(s.ctx, &sdk.CrossChainAppContext{}, serializedSynPackage)
s.Require().ErrorIs(res.Err, storageTypes.ErrNoSuchBucket)
Expand Down Expand Up @@ -146,7 +150,10 @@ func (s *TestSuite) TestSynCreatePolicyByMsg() {
}
serializedSynPackage := synPackage.MustSerialize()
serializedSynPackage = append([]byte{storageTypes.OperationCreatePolicy}, serializedSynPackage...)

storageKeeper.EXPECT().GetBucketInfoById(gomock.Any(), gomock.Any()).Return(&storageTypes.BucketInfo{
Owner: op.String(),
BucketName: "test-bucket",
}, true)
storageKeeper.EXPECT().GetResourceOwnerAndIdFromGRN(gomock.Any(), gomock.Any()).Return(op, resourceIds[0], nil).AnyTimes()
storageKeeper.EXPECT().NormalizePrincipal(gomock.Any(), gomock.Any()).Return().AnyTimes()
storageKeeper.EXPECT().ValidatePrincipal(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
Expand Down

0 comments on commit 3500eec

Please sign in to comment.