aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api/api_test.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-06-16 01:28:48 +0800
committerobscuren <geffobscura@gmail.com>2015-06-16 01:28:48 +0800
commit5daf8729be88eca87b302ebf7a46fc69cad0f6d0 (patch)
tree0053cb5b84978645b3c83895a651c512e081a183 /rpc/api/api_test.go
parentbac9a94ddf20dc530966cbf6cd384aaf94aedc77 (diff)
parent4673b04503742de9b1622557b44135d6a4934ad6 (diff)
downloadgo-tangerine-0.9.30.tar
go-tangerine-0.9.30.tar.gz
go-tangerine-0.9.30.tar.bz2
go-tangerine-0.9.30.tar.lz
go-tangerine-0.9.30.tar.xz
go-tangerine-0.9.30.tar.zst
go-tangerine-0.9.30.zip
Merge branch 'release/0.9.30'v0.9.30
Diffstat (limited to 'rpc/api/api_test.go')
-rw-r--r--rpc/api/api_test.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/rpc/api/api_test.go b/rpc/api/api_test.go
new file mode 100644
index 000000000..f1a47944d
--- /dev/null
+++ b/rpc/api/api_test.go
@@ -0,0 +1,42 @@
+package api
+
+import (
+ "testing"
+
+ "github.com/ethereum/go-ethereum/rpc/codec"
+)
+
+func TestParseApiString(t *testing.T) {
+ apis, err := ParseApiString("", codec.JSON, nil, nil)
+ if err == nil {
+ t.Errorf("Expected an err from parsing empty API string but got nil")
+ }
+
+ if len(apis) != 0 {
+ t.Errorf("Expected 0 apis from empty API string")
+ }
+
+ apis, err = ParseApiString("eth", codec.JSON, nil, nil)
+ if err != nil {
+ t.Errorf("Expected nil err from parsing empty API string but got %v", err)
+ }
+
+ if len(apis) != 1 {
+ t.Errorf("Expected 1 apis but got %d - %v", apis, apis)
+ }
+
+ apis, err = ParseApiString("eth,eth", codec.JSON, nil, nil)
+ if err != nil {
+ t.Errorf("Expected nil err from parsing empty API string but got \"%v\"", err)
+ }
+
+ if len(apis) != 2 {
+ t.Errorf("Expected 2 apis but got %d - %v", apis, apis)
+ }
+
+ apis, err = ParseApiString("eth,invalid", codec.JSON, nil, nil)
+ if err == nil {
+ t.Errorf("Expected an err but got no err")
+ }
+
+}