-
Notifications
You must be signed in to change notification settings - Fork 0
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
Blog: add comments #1
Changes from all commits
844058a
52ca24f
407c77a
91dc77a
452f6e2
25995fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,6 +182,57 @@ func (s *IntegrationTestSuite) TestAllPosts() { | |
} | ||
} | ||
|
||
func (s *IntegrationTestSuite) TestCreateComment() { | ||
val0 := s.network.Validators[0] | ||
|
||
testCases := []struct { | ||
postArgs []string | ||
commentArgs []string | ||
name string | ||
expErr bool | ||
expErrMsg string | ||
}{ | ||
{ | ||
postArgs: []string{val0.Address.String(), "/post", "title", "body"}, | ||
commentArgs: []string{val0.Address.String(), "/post", "content"}, | ||
name: "valid comment request", | ||
expErr: false, | ||
expErrMsg: "", | ||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
s.Run(tc.name, func() { | ||
postcmd := cli.CmdCreatePost() | ||
args := append([]string{ | ||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), | ||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), | ||
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), | ||
}, tc.postArgs...) | ||
_, err := clitestutil.ExecTestCLICmd(val0.ClientCtx, postcmd, args) | ||
s.Require().NoError(err) | ||
|
||
commentcmd := cli.CmdCreateComment() | ||
args = append([]string{ | ||
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), | ||
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), | ||
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), | ||
}, tc.commentArgs...) | ||
fmt.Printf("args %v+", args) | ||
out, err := clitestutil.ExecTestCLICmd(val0.ClientCtx, commentcmd, args) | ||
if tc.expErr { | ||
s.Require().Error(err) | ||
s.Require().Contains(err.Error(), tc.expErrMsg) | ||
} else { | ||
var txRes sdk.TxResponse | ||
err := val0.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &txRes) | ||
s.Require().NoError(err) | ||
s.Require().Equal(uint32(0), txRes.Code) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test failing currently due to: ...
network.go:360: starting test network...
network.go:365: started test network
--- FAIL: TestKeeperTestSuite/TestCreateComment (3.34s)
--- FAIL: TestKeeperTestSuite/TestCreateComment/valid_comment_request (3.34s)
cli_test.go:230:
Error Trace: cli_test.go:230
suite.go:77
Error: Not equal:
expected: 0x0
actual : 0x12
Test: TestKeeperTestSuite/TestCreateComment/valid_comment_request
cli_test.go:38: tearing down integration test suite Have looked at: But it does seem to run smoothly, so there might be an issue between sending the command to the grpc request to recieving the response. But looking for input here 🙏 |
||
} | ||
}) | ||
} | ||
} | ||
|
||
func TestKeeperTestSuite(t *testing.T) { | ||
suite.Run(t, new(IntegrationTestSuite)) | ||
} |
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.
protoc
move tobuf alpha