added reissuance tests and fixed conversion

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
Jürgen Eckel 2023-10-06 10:12:23 +02:00
parent f69c978911
commit a441ff87dd
No known key found for this signature in database
2 changed files with 37 additions and 2 deletions

View File

@ -13,7 +13,7 @@ func InitRDDLReissuanceProcess(ctx sdk.Context, proposerAddress string, blk_heig
//blk_height := 0 //get_last_PoPBlockHeight() // TODO: to be read form the upcoming PoP-store //blk_height := 0 //get_last_PoPBlockHeight() // TODO: to be read form the upcoming PoP-store
// Construct the command // Construct the command
cmd := exec.Command("planetmint-god", "tx", "dao", "reissue-rddl-proposal", hexProposerAddress, tx_unsigned, strconv.FormatInt(blk_height, 10)) cmd := exec.Command("planetmint-god", "tx", "dao", "reissue-rddl-proposal", proposerAddress, tx_unsigned, strconv.FormatInt(blk_height, 10))
// Start the command in a non-blocking way // Start the command in a non-blocking way
err = cmd.Start() err = cmd.Start()
@ -27,7 +27,7 @@ func InitRDDLReissuanceProcess(ctx sdk.Context, proposerAddress string, blk_heig
func SendRDDLReissuanceResult(ctx sdk.Context, proposerAddress string, txID string, blk_height uint64) error { func SendRDDLReissuanceResult(ctx sdk.Context, proposerAddress string, txID string, blk_height uint64) error {
// Construct the command // Construct the command
cmd := exec.Command("planetmint-god", "tx", "dao", "reissue-rddl-result", hexProposerAddress, txID, strconv.FormatInt(blk_height, 10)) cmd := exec.Command("planetmint-god", "tx", "dao", "reissue-rddl-result", proposerAddress, txID, strconv.FormatUint(blk_height, 10))
// Start the command in a non-blocking way // Start the command in a non-blocking way
err := cmd.Start() err := cmd.Start()

View File

@ -0,0 +1,35 @@
package keeper_test
import (
"fmt"
"testing"
keepertest "github.com/planetmint/planetmint-go/testutil/keeper"
"github.com/stretchr/testify/assert"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/x/dao/keeper"
"github.com/planetmint/planetmint-go/x/dao/types"
)
func createNReissuance(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Reissuance {
items := make([]types.Reissuance, n)
for i := range items {
items[i].BlockHeight = uint64(i)
items[i].Proposer = fmt.Sprintf("proposer_%v", i)
items[i].Rawtx = fmt.Sprintf("rawtransaction_%v", i)
items[i].TxId = ""
keeper.StoreReissuance(ctx, items[i])
}
return items
}
func TestGetResponse(t *testing.T) {
keeper, ctx := keepertest.DaoKeeper(t)
items := createNChallenge(keeper, ctx, 10)
for _, item := range items {
challenge, found := keeper.GetChallenge(ctx, item.Height)
assert.True(t, found)
assert.Equal(t, item, challenge)
}
}