mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-07 14:46:39 +00:00
added reissuance tests and fixed conversion
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
f69c978911
commit
a441ff87dd
@ -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()
|
||||||
|
35
x/dao/keeper/reissuance_test.go
Normal file
35
x/dao/keeper/reissuance_test.go
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user