-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd_submit_token_transfer_from_test.go
38 lines (27 loc) · 1.31 KB
/
cmd_submit_token_transfer_from_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"testing"
"storj.io/briskitall/test"
)
func TestSubmitTokenTransferFromCmd(t *testing.T) {
const amount = "100000000"
harness := test.Run(t)
// Transfer amount from multisig to account 2 to stage the transfer from
transferID := harness.MultiSig.SubmitTransfer(t, test.AccountKey[0], test.AccountAddress[2], amount)
harness.MultiSig.ConfirmTransaction(t, test.AccountKey[1], transferID)
// Account 2 approves the multisig account to transfer amount
harness.Token.Approve(t, test.AccountKey[2], harness.MultiSig.ContractAddress, amount)
transferFromID := transferID + 1
// Submits the transferFrom for amount from account 2 to account 3
requireCmdSuccess(t, harness, "submit", "token", "transfer-from",
test.AccountAddress[2], test.AccountAddress[3], amount,
"--sender-key-file", test.AccountKeyFile[0],
)
harness.Token.AssertBalance(t, harness.MultiSig.ContractAddress, "99900000000")
harness.Token.AssertBalance(t, test.AccountAddress[2], amount)
harness.Token.AssertBalance(t, test.AccountAddress[3], "0")
harness.MultiSig.ConfirmTransaction(t, test.AccountKey[1], transferFromID)
harness.Token.AssertBalance(t, harness.MultiSig.ContractAddress, "99900000000")
harness.Token.AssertBalance(t, test.AccountAddress[2], "0")
harness.Token.AssertBalance(t, test.AccountAddress[3], amount)
}