-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: fix gomock controller finish #1231
Conversation
@@ -291,34 +291,12 @@ func (suite *KeeperTestSuite) TestKeeper_ExportGenesis() { | |||
func (suite *KeeperTestSuite) TestKeeper_ImportGenesis() { | |||
testCases := []struct { | |||
name string | |||
setup func() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ImportGenesis does not require any expected keepers setting.
suite.sk.EXPECT(). | ||
GetSubspace(gomock.Any(), uint64(1)). | ||
Return( | ||
types.Subspace{ | ||
AdditionalFeeTokens: sdk.NewCoins(sdk.NewCoin("minttoken", sdk.NewInt(1))), | ||
}, | ||
true, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
manage subspace transaction does not check the subspaces additional fee tokens.
@@ -1491,14 +1491,6 @@ func (suite *KeeperTestSuite) TestMsgServer_RemovePostAttachment() { | |||
"cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", | |||
subspacestypes.NewPermission(types.PermissionModerateContent), | |||
).Return(false) | |||
|
|||
suite.sk.EXPECT().HasPermission( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not check the EditOwnContent
permission when post owner does not match the message sender.
@@ -669,7 +669,7 @@ func (suite *KeeperTestSuite) TestMsgServer_EditPost() { | |||
types.REPLY_SETTING_EVERYONE, | |||
time.Date(2020, 1, 1, 12, 00, 00, 000, time.UTC), | |||
nil, | |||
"cosmos1r9jamre0x0qqy562rhhckt6sryztwhnvhafyz4", | |||
"cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should ensure the the owner of post stored is the same as the sender without EditOwnContent
permission in this test
Codecov ReportPatch has no changes to coverable lines. 📢 Thoughts on this report? Let us know!. |
@@ -1170,7 +1170,7 @@ func (suite *KeeperTestSuite) TestMsgServer_AddPostAttachment() { | |||
gomock.Any(), | |||
uint64(1), | |||
uint32(0), | |||
"cosmos1r9jamre0x0qqy562rhhckt6sryztwhnvhafyz4", | |||
"cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should ensure the the owner of post stored is the same as the sender without EditOwnContent permission in this test.
@@ -1189,7 +1189,7 @@ func (suite *KeeperTestSuite) TestMsgServer_AddPostAttachment() { | |||
types.REPLY_SETTING_EVERYONE, | |||
time.Date(2020, 1, 1, 12, 00, 00, 000, time.UTC), | |||
nil, | |||
"cosmos1r9jamre0x0qqy562rhhckt6sryztwhnvhafyz4", | |||
"cosmos13t6y2nnugtshwuy0zkrq287a95lyy8vzleaxmd", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above
@@ -1845,6 +1837,24 @@ func (suite *KeeperTestSuite) TestMsgServer_AnswerPoll() { | |||
subspacestypes.NewPermission(types.PermissionInteractWithContent), | |||
).Return(false) | |||
}, | |||
store: func(ctx sdk.Context) { | |||
suite.k.SavePost(ctx, types.NewPost( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is missing post should be stored before the test.
@@ -3282,7 +3292,6 @@ func (suite *KeeperTestSuite) TestMsgServer_RequestPostOwnerTransfer() { | |||
func (suite *KeeperTestSuite) TestMsgServer_CancelPostOwnerTransfer() { | |||
testCases := []struct { | |||
name string | |||
setup func() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CancelPostOwnerTransfer
does not require expected keepers setting
@@ -3649,7 +3639,6 @@ func (suite *KeeperTestSuite) TestMsgServer_AcceptPostOwnerTransfer() { | |||
func (suite *KeeperTestSuite) TestMsgServer_RefusePostOwnerTransfer() { | |||
testCases := []struct { | |||
name string | |||
setup func() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, RefusePostOwnerTransfer
does not require expected keepers setting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! 💯
## Description ~~Deps: #1231~~ This PR improves `x/profiles` by mutation tests to increase mutation score of `x/profiles` to 0.887324. ``` ################################################################################ ### WARNING! This test will take hours to complete! ################################################################################ running mutation tests for the following module(s): profiles writing mutation test result to mutation_test_result.txt The mutation score is 0.887324 (252 passed, 2 failed, 0 duplicated, 30 skipped, total is 284) ``` <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://docs.cosmos.network/v0.44/building-modules/intro.html) - [ ] included the necessary unit and integration [tests](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [x] reviewed "Files changed" and left comments if necessary - [x] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --------- Co-authored-by: Riccardo <[email protected]>
Description
This PR fixes the gomock controller finish by moving it to the
TearDownTest
phase, or it cannot find the missing calls of the function we setup on expected keepers.It also fixes the tests having wrong setting on the expected keepers.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change