-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig_test.go
74 lines (66 loc) · 1.53 KB
/
config_test.go
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package client
import "testing"
func TestClient_GetConfig(t *testing.T) {
resp, err := client.GetConfig(&ConfigBase{DataId: "test"})
if err != nil {
t.Error(err)
}
t.Logf("%#v", resp)
}
func TestClient_ListenConfig(t *testing.T) {
resp, err := client.ListenConfig(&ListeningConfigs{
ConfigBase: ConfigBase{
DataId: "test",
},
ContentMD5: "67babf3f2726b3b92c1eceed1fe74e39",
})
if err != nil {
t.Error(err)
}
t.Logf("%#v", resp)
}
func TestClient_PublishConfig(t *testing.T) {
err := client.PublishConfig(&PublishConfigRequest{
ConfigBase: ConfigBase{
DataId: "dev",
},
Content: "text content112",
ContentType: "yaml",
})
if err != nil {
t.Error(err)
}
}
func TestClient_DeleteConfig(t *testing.T) {
err := client.DeleteConfig(&ConfigBase{DataId: "test1"})
if err != nil {
t.Error(err)
}
}
func TestClient_GetConfigHistory(t *testing.T) {
resp, err := client.GetConfigHistory(&GetConfigHistoryRequest{ConfigBase: ConfigBase{DataId: "test"}})
if err != nil {
t.Fatal(err)
}
t.Logf("%#v", resp)
}
func TestClient_GetConfigHistoryDetail(t *testing.T) {
resp, err := client.GetConfigHistoryDetail(&GetConfigHistoryDetailRequest{
ConfigBase: ConfigBase{DataId: "test"},
Nid: "4",
})
if err != nil {
t.Fatal(err)
}
t.Logf("%#v", resp)
}
func TestClient_GetConfigHistoryPrevious(t *testing.T) {
resp, err := client.GetConfigHistoryPrevious(&GetConfigHistoryPreviousRequest{
ConfigBase: ConfigBase{DataId: "test"},
Id: 1,
})
if err != nil {
t.Fatal(err)
}
t.Logf("%#v", resp)
}