gpu-compute-chain/x/colinearcore/keeper/locked_users_test.go

39 lines
922 B
Go
Raw Normal View History

2022-09-07 13:25:57 -07:00
package keeper_test
import (
"testing"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
keepertest "colinear/testutil/keeper"
"colinear/testutil/nullify"
"colinear/x/colinearcore/keeper"
"colinear/x/colinearcore/types"
)
func createTestLockedUsers(keeper *keeper.Keeper, ctx sdk.Context) types.LockedUsers {
item := types.LockedUsers{}
keeper.SetLockedUsers(ctx, item)
return item
}
func TestLockedUsersGet(t *testing.T) {
keeper, ctx := keepertest.ColinearcoreKeeper(t)
item := createTestLockedUsers(keeper, ctx)
rst, found := keeper.GetLockedUsers(ctx)
require.True(t, found)
require.Equal(t,
nullify.Fill(&item),
nullify.Fill(&rst),
)
}
func TestLockedUsersRemove(t *testing.T) {
keeper, ctx := keepertest.ColinearcoreKeeper(t)
createTestLockedUsers(keeper, ctx)
keeper.RemoveLockedUsers(ctx)
_, found := keeper.GetLockedUsers(ctx)
require.False(t, found)
}