Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
burrow
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hang Yu
burrow
Commits
63f91803
Unverified
Commit
63f91803
authored
8 years ago
by
Benjamin Bollen
Browse files
Options
Downloads
Patches
Plain Diff
client: add construction test for NameTx
parent
69612370
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/core/transaction_factory_test.go
+34
-3
34 additions, 3 deletions
client/core/transaction_factory_test.go
with
34 additions
and
3 deletions
client/core/transaction_factory_test.go
+
34
−
3
View file @
63f91803
...
...
@@ -28,8 +28,8 @@ func TestTransactionFactory(t *testing.T) {
mockKeyClient
:=
mockkeys
.
NewMockKeyClient
()
mockNodeClient
:=
mockclient
.
NewMockNodeClient
()
testTransactionFactorySend
(
t
,
mockNodeClient
,
mockKeyClient
)
// t.Run("NameTransaction", )
testTransactionFactoryCall
(
t
,
mockNodeClient
,
mockKeyClient
)
testTransactionFactoryName
(
t
,
mockNodeClient
,
mockKeyClient
)
// t.Run("PermissionTransaction", )
// t.Run("BondTransaction", )
// t.Run("UnbondTransaction", )
...
...
@@ -80,7 +80,7 @@ func testTransactionFactoryCall(t *testing.T,
amountString
:=
"1000"
// unset nonce so that we retrieve nonce from account
nonceString
:=
""
// set gas
// set gas
gasString
:=
"1000"
// set fee
feeString
:=
"100"
...
...
@@ -94,4 +94,35 @@ func testTransactionFactoryCall(t *testing.T,
t
.
Fail
()
}
// TODO: test content of Transaction
}
\ No newline at end of file
}
func
testTransactionFactoryName
(
t
*
testing
.
T
,
nodeClient
*
mockclient
.
MockNodeClient
,
keyClient
*
mockkeys
.
MockKeyClient
)
{
// generate an ED25519 key and ripemd160 address
addressString
:=
fmt
.
Sprintf
(
"%X"
,
keyClient
.
NewKey
())
// Public key can be queried from mockKeyClient.PublicKey(address)
// but here we let the transaction factory retrieve the public key
// which will then also overwrite the address we provide the function.
// As a result we will assert whether address generated above, is identical
// to address in generated transation.
publicKeyString
:=
""
// set an amount to transfer
amountString
:=
"1000"
// unset nonce so that we retrieve nonce from account
nonceString
:=
""
// set fee
feeString
:=
"100"
// set data
dataString
:=
fmt
.
Sprintf
(
"%X"
,
"We are DOUG."
)
// set name
nameString
:=
fmt
.
Sprintf
(
"%s"
,
"DOUG"
)
_
,
err
:=
Name
(
nodeClient
,
keyClient
,
publicKeyString
,
addressString
,
amountString
,
nonceString
,
feeString
,
nameString
,
dataString
)
if
err
!=
nil
{
t
.
Logf
(
"Error in NameTx: %s"
,
err
)
t
.
Fail
()
}
// TODO: test content of Transaction
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment