restructured eth rpc API
This commit is contained in:
		
				
					committed by
					
						 Bas van Kervel
						Bas van Kervel
					
				
			
			
				
	
			
			
			
						parent
						
							6609d45ef4
						
					
				
				
					commit
					2f55a1d798
				
			
							
								
								
									
										42
									
								
								rpc/api/api_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								rpc/api/api_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -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") | ||||
| 	} | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user