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
3ecb14cc
Commit
3ecb14cc
authored
Feb 10, 2020
by
mdj33
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ut
parent
2e0983d5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
relayd_test.go
plugin/dapp/relay/cmd/relayd/relayd/relayd_test.go
+27
-0
No files found.
plugin/dapp/relay/cmd/relayd/relayd/relayd_test.go
View file @
3ecb14cc
...
...
@@ -11,6 +11,9 @@ import (
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/types"
typesmocks
"github.com/33cn/chain33/types/mocks"
types2
"github.com/33cn/plugin/plugin/dapp/relay/types"
"github.com/stretchr/testify/mock"
)
func
TestGeneratePrivateKey
(
t
*
testing
.
T
)
{
...
...
@@ -28,3 +31,27 @@ func TestGeneratePrivateKey(t *testing.T) {
t
.
Log
(
"publick key: "
,
common
.
ToHex
(
key
.
PubKey
()
.
Bytes
()))
t
.
Log
(
" address: "
,
address
.
PubKeyToAddress
(
key
.
PubKey
()
.
Bytes
()))
}
func
TestDealOrder
(
t
*
testing
.
T
)
{
grpcClient
:=
&
typesmocks
.
Chain33Client
{}
relayd
:=
&
Relayd
{}
relayd
.
client33
=
&
Client33
{}
relayd
.
client33
.
Chain33Client
=
grpcClient
relayd
.
btcClient
=
&
btcdClient
{
connConfig
:
nil
,
chainParams
:
mainNetParams
.
Params
,
reconnectAttempts
:
3
,
enqueueNotification
:
make
(
chan
interface
{}),
dequeueNotification
:
make
(
chan
interface
{}),
currentBlock
:
make
(
chan
*
blockStamp
),
quit
:
make
(
chan
struct
{}),
}
relayorder
:=
&
types2
.
RelayOrder
{
Id
:
string
(
"id"
),
XTxHash
:
"hash"
}
rst
:=
&
types2
.
QueryRelayOrderResult
{
Orders
:
[]
*
types2
.
RelayOrder
{
relayorder
}}
reply
:=
&
types
.
Reply
{}
reply
.
Msg
=
types
.
Encode
(
rst
)
grpcClient
.
On
(
"QueryChain"
,
mock
.
Anything
,
mock
.
Anything
)
.
Return
(
reply
,
nil
)
.
Once
()
grpcClient
.
On
(
"SendTransaction"
,
mock
.
Anything
,
mock
.
Anything
)
.
Return
(
nil
,
nil
)
.
Once
()
relayd
.
dealOrder
()
}
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