-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_update_key.go
81 lines (60 loc) · 2.36 KB
/
test_update_key.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package currency
import (
"github.com/ProtoconNet/mitum-currency/v3/operation/test"
"github.com/ProtoconNet/mitum-currency/v3/types"
"github.com/ProtoconNet/mitum2/base"
"github.com/ProtoconNet/mitum2/util/encoder"
"github.com/stretchr/testify/mock"
)
type TestUpdateKeyProcessor struct {
*test.BaseTestOperationProcessorNoItem[UpdateKey]
}
func NewTestUpdateKeyProcessor(encs *encoder.Encoders) TestUpdateKeyProcessor {
t := test.NewBaseTestOperationProcessorNoItem[UpdateKey](encs)
return TestUpdateKeyProcessor{&t}
}
func (t *TestUpdateKeyProcessor) Create() *TestUpdateKeyProcessor {
t.Opr, _ = NewUpdateKeyProcessor()(
base.GenesisHeight,
t.GetStateFunc,
nil, nil,
)
return t
}
func (t *TestUpdateKeyProcessor) SetCurrency(
cid string, am int64, addr base.Address, target []types.CurrencyID, instate bool) *TestUpdateKeyProcessor {
t.BaseTestOperationProcessorNoItem.SetCurrency(cid, am, addr, target, instate)
return t
}
func (t *TestUpdateKeyProcessor) SetAmount(am int64, cid types.CurrencyID, target []types.Amount) *TestUpdateKeyProcessor {
t.BaseTestOperationProcessorNoItem.SetAmount(am, cid, target)
return t
}
func (t *TestUpdateKeyProcessor) SetContractAccount(
owner base.Address, priv string, amount int64, cid types.CurrencyID, target []test.Account, inState bool,
) *TestUpdateKeyProcessor {
t.BaseTestOperationProcessorNoItem.SetContractAccount(owner, priv, amount, cid, target, inState)
return t
}
func (t *TestUpdateKeyProcessor) SetAccount(
priv string, amount int64, cid types.CurrencyID, target []test.Account, inState bool) *TestUpdateKeyProcessor {
t.BaseTestOperationProcessorNoItem.SetAccount(priv, amount, cid, target, inState)
return t
}
func (t *TestUpdateKeyProcessor) LoadOperation(fileName string) *TestUpdateKeyProcessor {
t.BaseTestOperationProcessorNoItem.LoadOperation(fileName)
return t
}
func (t *TestUpdateKeyProcessor) Print(fileName string) *TestUpdateKeyProcessor {
t.BaseTestOperationProcessorNoItem.Print(fileName)
return t
}
func (t *TestUpdateKeyProcessor) MakeOperation(
sender base.Address, privatekey base.Privatekey, target types.AccountKeys, currency types.CurrencyID,
) *TestUpdateKeyProcessor {
t.MockGetter.On("Get", mock.Anything).Return(nil, false, nil)
op, _ := NewUpdateKey(NewUpdateKeyFact([]byte("token"), sender, target, currency))
_ = op.Sign(privatekey, t.NetworkID)
t.Op = op
return t
}