github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/rts/v1/softwareconfig/testing/requests_test.go (about) 1 package testing 2 3 import ( 4 "testing" 5 6 "github.com/huaweicloud/golangsdk/openstack/rts/v1/softwareconfig" 7 th "github.com/huaweicloud/golangsdk/testhelper" 8 fake "github.com/huaweicloud/golangsdk/testhelper/client" 9 ) 10 11 func TestCreateSoftwareConfig(t *testing.T) { 12 th.SetupHTTP() 13 defer th.TeardownHTTP() 14 HandleCreateSuccessfully(t, CreateOutput) 15 createOpts := softwareconfig.CreateOpts{Name: "test-cong"} 16 actual, err := softwareconfig.Create(fake.ServiceClient(), createOpts).Extract() 17 18 th.AssertNoErr(t, err) 19 20 expected := CreateExpected 21 th.AssertDeepEquals(t, expected, actual) 22 } 23 24 func TestListSoftwareConfig(t *testing.T) { 25 th.SetupHTTP() 26 defer th.TeardownHTTP() 27 HandleListSuccessfully(t, FullListOutput) 28 29 actual, err := softwareconfig.List(fake.ServiceClient(), softwareconfig.ListOpts{}) 30 if err != nil { 31 t.Errorf("Failed to extract vpcs: %v", err) 32 } 33 th.AssertDeepEquals(t, ListExpected, actual) 34 th.AssertNoErr(t, err) 35 } 36 37 func TestGetSoftwareConfig(t *testing.T) { 38 th.SetupHTTP() 39 defer th.TeardownHTTP() 40 HandleGetSuccessfully(t, GetOutput) 41 42 actual, err := softwareconfig.Get(fake.ServiceClient(), "e0be7e37-a581-4b24-bfb1-df4f3048c090").Extract() 43 th.AssertNoErr(t, err) 44 45 expected := GetExpected 46 th.AssertDeepEquals(t, expected, actual) 47 } 48 49 func TestDeleteSoftwareConfig(t *testing.T) { 50 th.SetupHTTP() 51 defer th.TeardownHTTP() 52 HandleDeleteSuccessfully(t) 53 54 err := softwareconfig.Delete(fake.ServiceClient(), "e2fe5553-a481-4549-9d0f-e208de3d98d1").ExtractErr() 55 th.AssertNoErr(t, err) 56 }