-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhttp_test.go
More file actions
58 lines (50 loc) · 1.13 KB
/
http_test.go
File metadata and controls
58 lines (50 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package steemutil
import (
"testing"
)
func TestRequestDataStructure(t *testing.T) {
req := RequestData{
Id: 1,
JsonRPC: "2.0",
Method: "test_method",
Params: []any{"param1", "param2"},
}
if req.Id != 1 {
t.Error("RequestData.Id not set correctly")
}
if req.JsonRPC != "2.0" {
t.Error("RequestData.JsonRPC not set correctly")
}
if req.Method != "test_method" {
t.Error("RequestData.Method not set correctly")
}
if len(req.Params) != 2 {
t.Error("RequestData.Params not set correctly")
}
}
func TestResponseDataStructure(t *testing.T) {
res := ResponseData{
Id: 1,
JsonRPC: "2.0",
Result: "test_result",
}
if res.Id != 1 {
t.Error("ResponseData.Id not set correctly")
}
if res.JsonRPC != "2.0" {
t.Error("ResponseData.JsonRPC not set correctly")
}
if res.Result != "test_result" {
t.Error("ResponseData.Result not set correctly")
}
}
func TestGetClient(t *testing.T) {
api := "https://api.steemit.com"
timeout := uint(30)
client := GetClient(api, timeout)
if client == nil {
t.Error("GetClient returned nil")
}
// Test that client implements IClient interface
var _ IClient = client
}