-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: improve test suite testutil/keeper by adding utility methods f…
…or state initialization (#1019) * adding helper utils to shorten boilerplate code * extending * cleaning up more code and adding optional args * semantics * semantics * fix comments and code format --------- Co-authored-by: Pantani <Pantani>
- Loading branch information
1 parent
a26d7c2
commit df001ee
Showing
8 changed files
with
66 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package keeper | ||
|
||
import ( | ||
"context" | ||
"math/rand" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/tendermint/spn/testutil/sample" | ||
) | ||
|
||
// CreateChain creates a chain in the store and returns launch ID. | ||
func (tm TestMsgServers) CreateChain(ctx context.Context, r *rand.Rand, coordAddress string, genesisURL string, hasProject bool, projectID uint64) uint64 { | ||
msgCreateChain := sample.MsgCreateChain(r, coordAddress, genesisURL, hasProject, projectID) | ||
res, err := tm.LaunchSrv.CreateChain(ctx, &msgCreateChain) | ||
require.NoError(tm.T, err) | ||
return res.LaunchID | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package keeper | ||
|
||
import ( | ||
"context" | ||
"math/rand" | ||
|
||
"github.com/stretchr/testify/require" | ||
"github.com/tendermint/spn/testutil/sample" | ||
) | ||
|
||
// CreateProject creates a coordinator in the store and returns ID with associated address | ||
func (tm TestMsgServers) CreateProject(ctx context.Context, r *rand.Rand, coordAddress string) (id uint64) { | ||
msgCreateProject := sample.MsgCreateProject(r, coordAddress) | ||
resProject, err := tm.ProjectSrv.CreateProject(ctx, &msgCreateProject) | ||
require.NoError(tm.T, err) | ||
return resProject.ProjectID | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters