aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/args_test.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-06-09 21:19:39 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-06-09 21:19:39 +0800
commit60b780c21b861766b06b2990b7bb8c41fd6d25f8 (patch)
tree66835ef4ca590e4c1e6d19bd3cf9cdb98f2718da /rpc/args_test.go
parent76148515fa7c4681d9d5d22d98e84474a645d014 (diff)
parent046411866b257f6242a37b561b8e417199f7e52b (diff)
downloaddexon-60b780c21b861766b06b2990b7bb8c41fd6d25f8.tar.gz
dexon-60b780c21b861766b06b2990b7bb8c41fd6d25f8.tar.zst
dexon-60b780c21b861766b06b2990b7bb8c41fd6d25f8.zip
Merge pull request #1217 from tgerring/rpcsign
Fix RPC sign
Diffstat (limited to 'rpc/args_test.go')
-rw-r--r--rpc/args_test.go61
1 files changed, 61 insertions, 0 deletions
diff --git a/rpc/args_test.go b/rpc/args_test.go
index aef459961..fc10d68cf 100644
--- a/rpc/args_test.go
+++ b/rpc/args_test.go
@@ -2508,3 +2508,64 @@ func TestSourceArgsEmpty(t *testing.T) {
t.Error(str)
}
}
+
+func TestSigArgs(t *testing.T) {
+ input := `["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", "0x0"]`
+ expected := new(NewSigArgs)
+ expected.From = "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"
+ expected.Data = "0x0"
+
+ args := new(NewSigArgs)
+ if err := json.Unmarshal([]byte(input), &args); err != nil {
+ t.Error(err)
+ }
+}
+
+func TestSigArgsEmptyData(t *testing.T) {
+ input := `["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", ""]`
+
+ args := new(NewSigArgs)
+ str := ExpectValidationError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}
+
+func TestSigArgsDataType(t *testing.T) {
+ input := `["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", 13]`
+
+ args := new(NewSigArgs)
+ str := ExpectInvalidTypeError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}
+
+func TestSigArgsEmptyFrom(t *testing.T) {
+ input := `["", "0x0"]`
+
+ args := new(NewSigArgs)
+ str := ExpectValidationError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}
+
+func TestSigArgsFromType(t *testing.T) {
+ input := `[false, "0x0"]`
+
+ args := new(NewSigArgs)
+ str := ExpectInvalidTypeError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}
+
+func TestSigArgsEmpty(t *testing.T) {
+ input := `[]`
+ args := new(NewSigArgs)
+ str := ExpectInsufficientParamsError(json.Unmarshal([]byte(input), args))
+ if len(str) > 0 {
+ t.Error(str)
+ }
+}