github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/acceptance/openstack/waf/v1/webtamper_rules_test.go (about)

     1  package v1
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/opentelekomcloud/gophertelekomcloud/acceptance/clients"
     7  	rules "github.com/opentelekomcloud/gophertelekomcloud/openstack/waf/v1/webtamperprotection_rules"
     8  	th "github.com/opentelekomcloud/gophertelekomcloud/testhelper"
     9  )
    10  
    11  func TestWebTamperRuleWorkflow(t *testing.T) {
    12  	client, err := clients.NewWafV1Client()
    13  	th.AssertNoErr(t, err)
    14  
    15  	pID := prepareAndRemovePolicy(t, client)
    16  	opts := rules.CreateOpts{
    17  		Hostname: "example.com",
    18  		Path:     "/*",
    19  	}
    20  	r, err := rules.Create(client, pID, opts).Extract()
    21  	th.AssertNoErr(t, err)
    22  	t.Cleanup(func() {
    23  		th.AssertNoErr(t, rules.Delete(client, pID, r.Id).ExtractErr())
    24  	})
    25  
    26  	th.AssertEquals(t, r.Path, opts.Path)
    27  	th.AssertEquals(t, r.PolicyID, pID)
    28  }