diff --git a/testutil/keeper/profile.go b/testutil/keeper/profile.go index e2f596a3e..b561b50fb 100644 --- a/testutil/keeper/profile.go +++ b/testutil/keeper/profile.go @@ -12,8 +12,13 @@ import ( ) // CreateCoordinator creates a coordinator in the store and returns ID with associated address -func (tm TestMsgServers) CreateCoordinator(ctx context.Context, r *rand.Rand) (id uint64, address sdk.AccAddress) { - addr := sample.AccAddress(r) +func (tm TestMsgServers) CreateCoordinator(ctx context.Context, r *rand.Rand, optionalAddress ...string) (id uint64, address sdk.AccAddress) { + var addr sdk.AccAddress + if optionalAddress == nil { + addr = sample.AccAddress(r) + } else { + addr = sdk.MustAccAddressFromBech32(optionalAddress[0]) + } res, err := tm.ProfileSrv.CreateCoordinator(ctx, &profiletypes.MsgCreateCoordinator{ Address: addr.String(), Description: sample.CoordinatorDescription(r), diff --git a/x/launch/keeper/msg_create_chain_test.go b/x/launch/keeper/msg_create_chain_test.go index a5201dfd1..14b274340 100644 --- a/x/launch/keeper/msg_create_chain_test.go +++ b/x/launch/keeper/msg_create_chain_test.go @@ -58,28 +58,20 @@ func TestMsgCreateChain(t *testing.T) { ) // Create an invalid coordinator - invalidCoordAddress := sample.Address(r) - msgCreateInvalidCoordinator := sample.MsgCreateCoordinator(invalidCoordAddress) - _, err := ts.ProfileSrv.CreateCoordinator(ctx, &msgCreateInvalidCoordinator) - require.NoError(t, err) + _, invalidCoordAddr := ts.CreateCoordinator(ctx, r) + invalidCoordAddress := invalidCoordAddr.String() // Create coordinators for i := range coordAddrs { addr := sample.Address(r) coordAddrs[i] = addr - msgCreateCoordinator := sample.MsgCreateCoordinator(addr) - resCoord, err := ts.ProfileSrv.CreateCoordinator(ctx, &msgCreateCoordinator) - require.NoError(t, err) - coordMap[addr] = resCoord.CoordinatorID + coordMap[addr], _ = ts.CreateCoordinator(ctx, r, addr) } // Create a project for each valid coordinator for i := range coordAddrs { addr := coordAddrs[i] - msgCreateProject := sample.MsgCreateProject(r, addr) - resProject, err := ts.ProjectSrv.CreateProject(ctx, &msgCreateProject) - require.NoError(t, err) - prjtMap[addr] = resProject.ProjectID + prjtMap[addr] = ts.CreateProject(ctx, r, addr) } // assign random sdk.Coins to `chainCreationFee` param and provide balance to coordinators diff --git a/x/project/keeper/msg_create_project_test.go b/x/project/keeper/msg_create_project_test.go index c8da9f092..4a299c2db 100644 --- a/x/project/keeper/msg_create_project_test.go +++ b/x/project/keeper/msg_create_project_test.go @@ -60,10 +60,7 @@ func TestMsgCreateProject(t *testing.T) { for i := range coordAddrs { addr := sample.Address(r) coordAddrs[i] = addr - msgCreateCoordinator := sample.MsgCreateCoordinator(addr) - resCoord, err := ts.ProfileSrv.CreateCoordinator(ctx, &msgCreateCoordinator) - require.NoError(t, err) - coordMap[addr] = resCoord.CoordinatorID + coordMap[addr], _ = ts.CreateCoordinator(ctx, r, addr) } })