Change GetQueryCmd to take client.Context (#6326)
* Change GetQueryCmd to take a client.Context * Update CHANGELOG Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
This commit is contained in:
co-authored by
Alexander Bezobchuk
parent
2e11c81668
commit
fed0c2317d
@@ -52,8 +52,8 @@ type AppModuleBasic interface {
|
||||
|
||||
// client functionality
|
||||
RegisterRESTRoutes(client.Context, *mux.Router)
|
||||
GetTxCmd(client.Context) *cobra.Command
|
||||
GetQueryCmd(*codec.Codec) *cobra.Command
|
||||
GetTxCmd(clientCtx client.Context) *cobra.Command
|
||||
GetQueryCmd(clientCtx client.Context) *cobra.Command
|
||||
}
|
||||
|
||||
// BasicManager is a collection of AppModuleBasic
|
||||
@@ -113,9 +113,9 @@ func (bm BasicManager) AddTxCommands(rootTxCmd *cobra.Command, ctx client.Contex
|
||||
}
|
||||
|
||||
// AddQueryCommands adds all query commands to the rootQueryCmd
|
||||
func (bm BasicManager) AddQueryCommands(rootQueryCmd *cobra.Command, cdc *codec.Codec) {
|
||||
func (bm BasicManager) AddQueryCommands(rootQueryCmd *cobra.Command, clientCtx client.Context) {
|
||||
for _, b := range bm {
|
||||
if cmd := b.GetQueryCmd(cdc); cmd != nil {
|
||||
if cmd := b.GetQueryCmd(clientCtx); cmd != nil {
|
||||
rootQueryCmd.AddCommand(cmd)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ func TestBasicManager(t *testing.T) {
|
||||
mockAppModuleBasic1.EXPECT().RegisterRESTRoutes(gomock.Eq(client.Context{}), gomock.Eq(&mux.Router{})).Times(1)
|
||||
mockAppModuleBasic1.EXPECT().RegisterCodec(gomock.Eq(cdc)).Times(1)
|
||||
mockAppModuleBasic1.EXPECT().GetTxCmd(clientCtx).Times(1).Return(nil)
|
||||
mockAppModuleBasic1.EXPECT().GetQueryCmd(cdc).Times(1).Return(nil)
|
||||
mockAppModuleBasic1.EXPECT().GetQueryCmd(clientCtx).Times(1).Return(nil)
|
||||
|
||||
mm := module.NewBasicManager(mockAppModuleBasic1)
|
||||
require.Equal(t, mm["mockAppModuleBasic1"], mockAppModuleBasic1)
|
||||
@@ -55,7 +55,7 @@ func TestBasicManager(t *testing.T) {
|
||||
mockCmd := &cobra.Command{Use: "root"}
|
||||
mm.AddTxCommands(mockCmd, clientCtx)
|
||||
|
||||
mm.AddQueryCommands(mockCmd, cdc)
|
||||
mm.AddQueryCommands(mockCmd, clientCtx)
|
||||
|
||||
// validate genesis returns nil
|
||||
require.Nil(t, module.NewBasicManager().ValidateGenesis(cdc, wantDefaultGenesis))
|
||||
|
||||
Reference in New Issue
Block a user