| package testing |
| |
| import ( |
| "github.com/gophercloud/gophercloud/openstack/sharedfilesystems/v2/shares" |
| th "github.com/gophercloud/gophercloud/testhelper" |
| "github.com/gophercloud/gophercloud/testhelper/client" |
| "testing" |
| ) |
| |
| func TestCreate(t *testing.T) { |
| th.SetupHTTP() |
| defer th.TeardownHTTP() |
| |
| MockCreateResponse(t) |
| |
| options := &shares.CreateOpts{Size: 1, Name: "my_test_share", ShareProto: "NFS"} |
| n, err := shares.Create(client.ServiceClient(), options).Extract() |
| |
| th.AssertNoErr(t, err) |
| th.AssertEquals(t, n.Name, "my_test_share") |
| th.AssertEquals(t, n.Size, 1) |
| th.AssertEquals(t, n.ShareProto, "NFS") |
| } |
| |
| func TestDelete(t *testing.T) { |
| th.SetupHTTP() |
| defer th.TeardownHTTP() |
| |
| MockDeleteResponse(t) |
| |
| result := shares.Delete(client.ServiceClient(), shareID) |
| th.AssertNoErr(t, result.Err) |
| } |