github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/fgs/v2/trigger/testing/requests_test.go (about) 1 package testing 2 3 import ( 4 "testing" 5 6 "github.com/huaweicloud/golangsdk/openstack/fgs/v2/trigger" 7 th "github.com/huaweicloud/golangsdk/testhelper" 8 "github.com/huaweicloud/golangsdk/testhelper/client" 9 ) 10 11 func TestCreateV2Trigger(t *testing.T) { 12 th.SetupHTTP() 13 defer th.TeardownHTTP() 14 handleV2TriggerCreate(t) 15 16 actual, err := trigger.Create(client.ServiceClient(), createOpts, 17 "urn:fss:cn-north-4:0721565481a5d123f6e6c66a2115215a:function:default:test").Extract() 18 th.AssertNoErr(t, err) 19 th.AssertDeepEquals(t, expectedGetResponseData, actual) 20 } 21 22 func TestGetV2Trigger(t *testing.T) { 23 th.SetupHTTP() 24 defer th.TeardownHTTP() 25 handleV2TriggerGet(t) 26 27 actual, err := trigger.Get(client.ServiceClient(), 28 "urn:fss:cn-north-4:0721565481a5d123f6e6c66a2115215a:function:default:test", 29 "TIMER", "971f9cff-5d29-42da-ba36-e4e2b9d26664").Extract() 30 th.AssertNoErr(t, err) 31 th.AssertDeepEquals(t, expectedGetResponseData, actual) 32 } 33 34 func TestListV2Trigger(t *testing.T) { 35 th.SetupHTTP() 36 defer th.TeardownHTTP() 37 handleV2TriggerList(t) 38 39 pages, err := trigger.List(client.ServiceClient(), 40 "urn:fss:cn-north-4:0721565481a5d123f6e6c66a2115215a:function:default:test").AllPages() 41 th.AssertNoErr(t, err) 42 actual, err := trigger.ExtractList(pages) 43 th.AssertNoErr(t, err) 44 th.AssertDeepEquals(t, expectedListResponseData, actual) 45 } 46 47 func TestUpdateV2Trigger(t *testing.T) { 48 th.SetupHTTP() 49 defer th.TeardownHTTP() 50 handleV2TriggerUpdate(t) 51 52 err := trigger.Update(client.ServiceClient(), updateOpts, 53 "urn:fss:cn-north-4:0721565481a5d123f6e6c66a2115215a:function:default:test", 54 "TIMER", "971f9cff-5d29-42da-ba36-e4e2b9d26664").ExtractErr() 55 th.AssertNoErr(t, err) 56 } 57 58 func TestDeleteV2Trigger(t *testing.T) { 59 th.SetupHTTP() 60 defer th.TeardownHTTP() 61 handleV2TriggerDelete(t) 62 63 err := trigger.Delete(client.ServiceClient(), 64 "urn:fss:cn-north-4:0721565481a5d123f6e6c66a2115215a:function:default:test", 65 "TIMER", "971f9cff-5d29-42da-ba36-e4e2b9d26664").ExtractErr() 66 th.AssertNoErr(t, err) 67 }