/
mock_module.go
80 lines (57 loc) · 1.98 KB
/
mock_module.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package fixture
import (
"encoding/json"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/proto/tendermint/crypto"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
)
/*
* This mock module is needed to bypass the requirement of validator updates in the SDK module manager.
* Since there are no validator updates when testing, we inject one via this mock module.
*/
var _ module.AppModule = MockModule{}
type MockModule struct{}
func (m MockModule) Name() string {
return "mocker"
}
func (m MockModule) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {}
func (m MockModule) RegisterInterfaces(_ types.InterfaceRegistry) {}
func (m MockModule) DefaultGenesis(_ codec.JSONCodec) json.RawMessage {
return nil
}
func (m MockModule) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConfig, _ json.RawMessage) error {
return nil
}
func (m MockModule) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) {}
func (m MockModule) GetTxCmd() *cobra.Command {
return nil
}
func (m MockModule) GetQueryCmd() *cobra.Command {
return nil
}
func (m MockModule) InitGenesis(_ sdk.Context, _ codec.JSONCodec, _ json.RawMessage) []abci.ValidatorUpdate {
return []abci.ValidatorUpdate{{PubKey: crypto.PublicKey{}, Power: 40}}
}
func (m MockModule) ExportGenesis(_ sdk.Context, _ codec.JSONCodec) json.RawMessage {
return nil
}
func (m MockModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
func (m MockModule) Route() sdk.Route {
return sdk.Route{}
}
func (m MockModule) QuerierRoute() string {
return ""
}
func (m MockModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier {
return nil
}
func (m MockModule) RegisterServices(_ module.Configurator) {}
func (m MockModule) ConsensusVersion() uint64 {
return 1
}