github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/antiddos/v2/alarmreminding/testing/fixtures.go (about)

     1  package testing
     2  
     3  import (
     4  	"fmt"
     5  	"net/http"
     6  	"testing"
     7  
     8  	"github.com/huaweicloud/golangsdk/openstack/antiddos/v2/alarmreminding"
     9  
    10  	th "github.com/huaweicloud/golangsdk/testhelper"
    11  	"github.com/huaweicloud/golangsdk/testhelper/client"
    12  )
    13  
    14  var WarnAlertOutput = `
    15  {
    16    "warn_config": {
    17      "antiDDoS": false,
    18      "bruce_force": true,
    19      "remote_login": false,
    20      "weak_password": false,
    21      "high_privilege": false,
    22      "back_doors": false,
    23      "waf": true,
    24      "send_frequency": 1
    25    },
    26    "topic_urn": "ABC",
    27    "display_name": "123"
    28  }
    29  `
    30  
    31  var WarnAlertResponse = alarmreminding.WarnAlertResponse{
    32  	WarnConfig: struct {
    33  		AntiDDoS      bool `json:"antiDDoS,"`
    34  		BruceForce    bool `json:"bruce_force,omitempty"`
    35  		RemoteLogin   bool `json:"remote_login,omitempty"`
    36  		WeakPassword  bool `json:"weak_password,omitempty"`
    37  		HighPrivilege bool `json:"high_privilege,omitempty"`
    38  		BackDoors     bool `json:"back_doors,omitempty"`
    39  		Waf           bool `json:"waf,omitempty"`
    40  		SendFrequency int  `json:"send_frequency,omitempty"`
    41  	}{
    42  		AntiDDoS:      false,
    43  		BruceForce:    true,
    44  		RemoteLogin:   false,
    45  		WeakPassword:  false,
    46  		HighPrivilege: false,
    47  		BackDoors:     false,
    48  		Waf:           true,
    49  		SendFrequency: 1,
    50  	},
    51  	TopicUrn:    "ABC",
    52  	DisplayName: "123",
    53  }
    54  
    55  func HandleWarnAlertSuccessfully(t *testing.T) {
    56  	th.Mux.HandleFunc("/warnalert/alertconfig/query", func(w http.ResponseWriter, r *http.Request) {
    57  		th.TestMethod(t, r, "GET")
    58  		th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
    59  
    60  		w.Header().Add("Content-Type", "application/json")
    61  		fmt.Fprintf(w, WarnAlertOutput)
    62  	})
    63  }