Add a test for params gRPC request
This commit is contained in:
parent
b57ca60277
commit
eefaa42eec
@ -11,6 +11,7 @@ import (
|
||||
|
||||
func TestE2ETestSuite(t *testing.T) {
|
||||
cfg := network.DefaultConfig(e2e.NewTestNetworkFixture)
|
||||
cfg.NumValidators = 2
|
||||
cfg.NumValidators = 1
|
||||
|
||||
suite.Run(t, NewE2ETestSuite(cfg))
|
||||
}
|
||||
|
26
tests/e2e/auction/grpc.go
Normal file
26
tests/e2e/auction/grpc.go
Normal file
@ -0,0 +1,26 @@
|
||||
package auction
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
|
||||
auctiontypes "git.vdb.to/cerc-io/laconic2d/x/auction"
|
||||
)
|
||||
|
||||
func (ets *E2ETestSuite) TestQueryParamsGrpc() {
|
||||
val := ets.network.Validators[0]
|
||||
sr := ets.Require()
|
||||
reqURL := fmt.Sprintf("%s/cerc/auction/v1/params", val.APIAddress)
|
||||
|
||||
ets.Run("valid request to get auction params", func() {
|
||||
resp, err := testutil.GetRequest(reqURL)
|
||||
ets.Require().NoError(err)
|
||||
|
||||
var params auctiontypes.QueryParamsResponse
|
||||
err = val.ClientCtx.Codec.UnmarshalJSON(resp, ¶ms)
|
||||
|
||||
sr.NoError(err)
|
||||
sr.Equal(*params.GetParams(), auctiontypes.DefaultParams())
|
||||
})
|
||||
}
|
@ -15,16 +15,18 @@ import (
|
||||
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
||||
"github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/cosmos/cosmos-sdk/x/staking"
|
||||
|
||||
laconicApp "git.vdb.to/cerc-io/laconic2d/app"
|
||||
"git.vdb.to/cerc-io/laconic2d/app/params"
|
||||
auctionmodule "git.vdb.to/cerc-io/laconic2d/x/auction/module"
|
||||
bondmodule "git.vdb.to/cerc-io/laconic2d/x/bond/module"
|
||||
registrymodule "git.vdb.to/cerc-io/laconic2d/x/registry/module"
|
||||
)
|
||||
|
||||
// NewTestNetworkFixture returns a new simapp AppConstructor for network simulation tests
|
||||
// NewTestNetworkFixture returns a new LaconicApp AppConstructor for network simulation tests
|
||||
func NewTestNetworkFixture() network.TestFixture {
|
||||
dir, err := os.MkdirTemp("", "simapp")
|
||||
dir, err := os.MkdirTemp("", "laconic")
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("failed creating temporary directory: %v", err))
|
||||
}
|
||||
@ -50,11 +52,15 @@ func NewTestNetworkFixture() network.TestFixture {
|
||||
return app
|
||||
}
|
||||
|
||||
// Update prefixes
|
||||
params.SetAddressPrefixes()
|
||||
|
||||
return network.TestFixture{
|
||||
AppConstructor: appCtr,
|
||||
GenesisState: app.DefaultGenesis(),
|
||||
EncodingConfig: testutil.MakeTestEncodingConfig(
|
||||
auth.AppModuleBasic{},
|
||||
staking.AppModuleBasic{},
|
||||
auctionmodule.AppModule{},
|
||||
bondmodule.AppModule{},
|
||||
registrymodule.AppModule{},
|
||||
|
Loading…
Reference in New Issue
Block a user