Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
alpe committed Apr 2, 2020
1 parent 8e89dae commit 6cf530c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
8 changes: 8 additions & 0 deletions incubator/group/group.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package group

import "github.com/cosmos/modules/incubator/orm"

// AccountCondition returns a condition to build a group account address.
func AccountCondition(id uint64) Condition {
return NewCondition("group", "account", orm.EncodeSequence(id))
}
6 changes: 0 additions & 6 deletions incubator/group/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/modules/incubator/orm"
"github.com/gogo/protobuf/jsonpb"
"github.com/gorilla/mux"
"github.com/spf13/cobra"
Expand All @@ -32,11 +31,6 @@ const (
DefaultParamspace = ModuleName
)

// AccountCondition returns a condition to build a group account address.
func AccountCondition(id uint64) Condition {
return NewCondition("group", "account", orm.EncodeSequence(id))
}

type AppModule struct {
keeper Keeper
}
Expand Down
27 changes: 27 additions & 0 deletions incubator/group/module_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package group

import (
"testing"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/params"
"github.com/cosmos/cosmos-sdk/x/params/subspace"
"github.com/stretchr/testify/assert"
abci "github.com/tendermint/tendermint/abci/types"
)

func TestInitWithDefaultGenesis(t *testing.T) {
amino := codec.New()
pKey, pTKey := sdk.NewKVStoreKey(params.StoreKey), sdk.NewTransientStoreKey(params.TStoreKey)
paramSpace := subspace.NewSubspace(amino, pKey, pTKey, DefaultParamspace)

groupKey := sdk.NewKVStoreKey(StoreKeyName)
k := NewGroupKeeper(groupKey, paramSpace, baseapp.NewRouter(), &MockProposalI{})
ctx := NewContext(pKey, pTKey, groupKey)

module := NewAppModule(k)
assert.Equal(t, []abci.ValidatorUpdate{}, module.InitGenesis(ctx, module.DefaultGenesis()))
assert.Equal(t, DefaultParams(), k.GetParams(ctx))
}

0 comments on commit 6cf530c

Please sign in to comment.