Skip to content

Commit

Permalink
test: config old and new key
Browse files Browse the repository at this point in the history
  • Loading branch information
whalelephant committed Aug 10, 2021
1 parent a70704f commit c8fec27
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions lib/go/keys/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
)

func TestAddNewPendingKeyRemoval(t *testing.T) {
func TestAddAndExecuteKeyRemoval(t *testing.T) {
g := gwtf.NewGoWithTheFlow("../../../flow.json")

vaultAcct := "vaulted-account"
Expand Down Expand Up @@ -50,12 +50,12 @@ func TestRemovedKeyCannotAddSig(t *testing.T) {
assert.Error(t, err)
}

func TestAddNewPendingKeyConfig(t *testing.T) {
func TestAddAndExecuteKeyConfig(t *testing.T) {
g := gwtf.NewGoWithTheFlow("../../../flow.json")

vaultAcct := "vaulted-account"
payerAcct := "owner"
newAcct := vault.Acct500_1
newAcct := vault.Acct500_2
newAcctWeight := "100.00000000"

initTxIndex, err := util.GetTxIndex(g, vaultAcct)
Expand All @@ -74,3 +74,28 @@ func TestAddNewPendingKeyConfig(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, newAcctWeight, weight.String())
}

func TestAddAndExecuteNewKeyConfig(t *testing.T) {
g := gwtf.NewGoWithTheFlow("../../../flow.json")

vaultAcct := "vaulted-account"
payerAcct := "owner"
newAcct := "non-registered-account"
newAcctWeight := "150.00000000"

initTxIndex, err := util.GetTxIndex(g, vaultAcct)
assert.NoError(t, err)

_, err = MultiSig_ConfigKey(g, newAcct, newAcctWeight, initTxIndex+uint64(1), vault.Acct1000, vaultAcct, true)
assert.NoError(t, err)

postTxIndex, err := util.GetTxIndex(g, vaultAcct)
assert.NoError(t, err)

_, err = vault.MultiSig_VaultExecuteTx(g, postTxIndex, payerAcct, vaultAcct)
assert.NoError(t, err)

weight, err := util.GetKeyWeight(g, vaultAcct, newAcct)
assert.NoError(t, err)
assert.Equal(t, newAcctWeight, weight.String())
}

0 comments on commit c8fec27

Please sign in to comment.