blob: c4e811c52a8567a9f4aff47a6bccd7f9da97ca27 [file] [log] [blame]
Mikko Valkonen20de7802016-10-24 22:25:01 +03001package testing
2
3import (
4 "github.com/gophercloud/gophercloud/openstack/sharedfilesystems/v2/shares"
5 th "github.com/gophercloud/gophercloud/testhelper"
6 "github.com/gophercloud/gophercloud/testhelper/client"
7 "testing"
8)
9
10func TestCreate(t *testing.T) {
11 th.SetupHTTP()
12 defer th.TeardownHTTP()
13
14 MockCreateResponse(t)
15
16 options := &shares.CreateOpts{Size: 1, Name: "my_test_share", ShareProto: "NFS"}
17 n, err := shares.Create(client.ServiceClient(), options).Extract()
18
19 th.AssertNoErr(t, err)
20 th.AssertEquals(t, n.Name, "my_test_share")
21 th.AssertEquals(t, n.Size, 1)
22 th.AssertEquals(t, n.ShareProto, "NFS")
23}
Mikko Valkonen4c108b52016-10-24 23:11:25 +030024
25func TestDelete(t *testing.T) {
26 th.SetupHTTP()
27 defer th.TeardownHTTP()
28
29 MockDeleteResponse(t)
30
31 result := shares.Delete(client.ServiceClient(), shareID)
32 th.AssertNoErr(t, result.Err)
33}