-
Notifications
You must be signed in to change notification settings - Fork 8
/
testMocks.go
51 lines (42 loc) · 1.14 KB
/
testMocks.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
package hivego
import "time"
func getTestVoteOp() hiveOperation {
return voteOperation{
Voter: "xeroc",
Author: "xeroc",
Permlink: "piston",
Weight: 10000,
opText: "vote",
}
}
func getTestCustomJsonOp() hiveOperation {
return customJsonOperation{
RequiredAuths: []string{},
RequiredPostingAuths: []string{"xeroc"},
Id: "test-id",
Json: "{\"testk\":\"testv\"}",
opText: "custom_json",
}
}
func getTwoTestOps() []hiveOperation {
return []hiveOperation{getTestVoteOp(), getTestCustomJsonOp()}
}
func getTestTx(ops []hiveOperation) hiveTransaction {
exp, _ := time.Parse("2006-01-02T15:04:05", "2016-08-08T12:24:17")
expStr := exp.Format("2006-01-02T15:04:05")
return hiveTransaction{
RefBlockNum: 36029,
RefBlockPrefix: 1164960351,
Expiration: expStr,
Operations: ops,
}
}
func getTestVoteTx() hiveTransaction {
return getTestTx([]hiveOperation{getTestVoteOp()})
}
func getTestCustomJsonTx() hiveTransaction {
return getTestTx([]hiveOperation{getTestCustomJsonOp()})
}
func getTestMultipleOpsTx() hiveTransaction {
return getTestTx(getTwoTestOps())
}