This repository has been archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
/
fixtures.go
63 lines (56 loc) · 1.55 KB
/
fixtures.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
package testing
import (
"fmt"
"net/http"
"testing"
"github.com/huaweicloud/golangsdk/openstack/antiddos/v2/alarmreminding"
th "github.com/huaweicloud/golangsdk/testhelper"
"github.com/huaweicloud/golangsdk/testhelper/client"
)
var WarnAlertOutput = `
{
"warn_config": {
"antiDDoS": false,
"bruce_force": true,
"remote_login": false,
"weak_password": false,
"high_privilege": false,
"back_doors": false,
"waf": true,
"send_frequency": 1
},
"topic_urn": "ABC",
"display_name": "123"
}
`
var WarnAlertResponse = alarmreminding.WarnAlertResponse{
WarnConfig: struct {
AntiDDoS bool `json:"antiDDoS,"`
BruceForce bool `json:"bruce_force,omitempty"`
RemoteLogin bool `json:"remote_login,omitempty"`
WeakPassword bool `json:"weak_password,omitempty"`
HighPrivilege bool `json:"high_privilege,omitempty"`
BackDoors bool `json:"back_doors,omitempty"`
Waf bool `json:"waf,omitempty"`
SendFrequency int `json:"send_frequency,omitempty"`
}{
AntiDDoS: false,
BruceForce: true,
RemoteLogin: false,
WeakPassword: false,
HighPrivilege: false,
BackDoors: false,
Waf: true,
SendFrequency: 1,
},
TopicUrn: "ABC",
DisplayName: "123",
}
func HandleWarnAlertSuccessfully(t *testing.T) {
th.Mux.HandleFunc("/warnalert/alertconfig/query", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "GET")
th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
w.Header().Add("Content-Type", "application/json")
fmt.Fprintf(w, WarnAlertOutput)
})
}