Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
85ca220e
Commit
85ca220e
authored
Jul 21, 2021
by
mdj33
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ut
parent
ca80cac4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
boardaction_test.go
plugin/dapp/autonomy/executor/boardaction_test.go
+15
-12
No files found.
plugin/dapp/autonomy/executor/boardaction_test.go
View file @
85ca220e
...
...
@@ -23,6 +23,7 @@ import (
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
ticket
"github.com/33cn/plugin/plugin/dapp/ticket/executor"
ticketTy
"github.com/33cn/plugin/plugin/dapp/ticket/types"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
...
...
@@ -195,43 +196,43 @@ func TestPropBoard(t *testing.T) {
opts
:=
[]
*
auty
.
ProposalBoard
{
{
// ErrRepeatAddr
Update
:
true
,
BoardUpdate
:
auty
.
BoardUpdate_ADD
,
Boards
:
[]
string
{
"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"
,
"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"
},
StartBlockHeight
:
env
.
blockHeight
+
5
,
EndBlockHeight
:
env
.
blockHeight
+
startEndBlockPeriod
+
10
,
},
{
// ErrRepeatAddr
Update
:
true
,
BoardUpdate
:
auty
.
BoardUpdate_ADD
,
Boards
:
[]
string
{
"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"
,
AddrA
},
StartBlockHeight
:
env
.
blockHeight
+
5
,
EndBlockHeight
:
env
.
blockHeight
+
startEndBlockPeriod
+
10
,
},
{
// ErrBoardNumber
Update
:
true
,
BoardUpdate
:
auty
.
BoardUpdate_ADD
,
StartBlockHeight
:
env
.
blockHeight
+
5
,
EndBlockHeight
:
env
.
blockHeight
+
startEndBlockPeriod
+
10
,
},
{
// 正常
Update
:
true
,
BoardUpdate
:
auty
.
BoardUpdate_ADD
,
Boards
:
[]
string
{
"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"
},
StartBlockHeight
:
env
.
blockHeight
+
5
,
EndBlockHeight
:
env
.
blockHeight
+
startEndBlockPeriod
+
10
,
},
{
// ErrRepeatAddr
Update
:
false
,
BoardUpdate
:
auty
.
BoardUpdate_WHOLE
,
Boards
:
[]
string
{
"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"
,
"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"
},
StartBlockHeight
:
env
.
blockHeight
+
5
,
EndBlockHeight
:
env
.
blockHeight
+
startEndBlockPeriod
+
10
,
},
{
// ErrBoardNumber
Update
:
false
,
BoardUpdate
:
auty
.
BoardUpdate_WHOLE
,
Boards
:
[]
string
{
"18e1nfiux7aVSfN2zYUZhbidMRokbBSPA6"
,
AddrA
},
StartBlockHeight
:
env
.
blockHeight
+
5
,
EndBlockHeight
:
env
.
blockHeight
+
startEndBlockPeriod
+
10
,
},
{
// 正常
Update
:
false
,
BoardUpdate
:
auty
.
BoardUpdate_WHOLE
,
Boards
:
boards
,
StartBlockHeight
:
env
.
blockHeight
+
5
,
EndBlockHeight
:
env
.
blockHeight
+
startEndBlockPeriod
+
10
,
...
...
@@ -256,7 +257,8 @@ func TestPropBoard(t *testing.T) {
pbtx
,
err
=
signTx
(
pbtx
,
PrivKeyA
)
assert
.
NoError
(
t
,
err
)
_
,
err
=
exec
.
Exec
(
pbtx
,
i
)
assert
.
Equal
(
t
,
err
,
result
[
i
])
assert
.
Equal
(
t
,
errors
.
Cause
(
err
),
result
[
i
])
}
}
...
...
@@ -290,6 +292,7 @@ func testPropBoard(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB dbm.
Month
:
7
,
Day
:
10
,
Boards
:
boards
,
BoardUpdate
:
auty
.
BoardUpdate_WHOLE
,
StartBlockHeight
:
env
.
blockHeight
+
5
,
EndBlockHeight
:
env
.
blockHeight
+
startEndBlockPeriod
+
10
,
}
...
...
@@ -423,19 +426,19 @@ func voteProposalBoard(t *testing.T, env *ExecEnv, exec drivers.Driver, stateDB
// 4人参与投票,3人赞成票,1人反对票
type
record
struct
{
priv
string
appr
bool
vote
auty
.
AutonomyVoteOption
origin
[]
string
}
records
:=
[]
record
{
{
priv
:
PrivKeyA
,
appr
:
false
},
{
priv
:
PrivKey1
,
appr
:
true
,
origin
:
[]
string
{
AddrB
,
AddrC
,
AddrD
}},
{
priv
:
PrivKeyA
,
vote
:
auty
.
AutonomyVoteOption_OPPOSE
},
{
priv
:
PrivKey1
,
vote
:
auty
.
AutonomyVoteOption_APPROVE
,
origin
:
[]
string
{
AddrB
,
AddrC
,
AddrD
}},
}
InitMinerAddr
(
stateDB
,
[]
string
{
AddrB
,
AddrC
,
AddrD
},
Addr1
)
for
i
,
record
:=
range
records
{
opt
:=
&
auty
.
VoteProposalBoard
{
ProposalID
:
proposalID
,
Approve
:
record
.
appr
,
VoteOption
:
record
.
vote
,
OriginAddr
:
record
.
origin
,
}
tx
,
err
:=
voteProposalBoardTx
(
opt
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment