feature/shared file systems: show share details (#127)
* sfs/shares: get a share with details
* sfs/shares: use AssertDeepEquals in get share test
diff --git a/openstack/sharedfilesystems/v2/shares/testing/request_test.go b/openstack/sharedfilesystems/v2/shares/testing/request_test.go
index c4e811c..7735e02 100644
--- a/openstack/sharedfilesystems/v2/shares/testing/request_test.go
+++ b/openstack/sharedfilesystems/v2/shares/testing/request_test.go
@@ -1,10 +1,12 @@
package testing
import (
+ "github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/sharedfilesystems/v2/shares"
th "github.com/gophercloud/gophercloud/testhelper"
"github.com/gophercloud/gophercloud/testhelper/client"
"testing"
+ "time"
)
func TestCreate(t *testing.T) {
@@ -31,3 +33,53 @@
result := shares.Delete(client.ServiceClient(), shareID)
th.AssertNoErr(t, result.Err)
}
+
+func TestGet(t *testing.T) {
+ th.SetupHTTP()
+ defer th.TeardownHTTP()
+
+ MockGetResponse(t)
+
+ s, err := shares.Get(client.ServiceClient(), shareID).Extract()
+ th.AssertNoErr(t, err)
+ th.AssertDeepEquals(t, s, &shares.Share{
+ AvailabilityZone: "nova",
+ ShareNetworkID: "713df749-aac0-4a54-af52-10f6c991e80c",
+ ShareServerID: "e268f4aa-d571-43dd-9ab3-f49ad06ffaef",
+ SnapshotID: "",
+ ID: shareID,
+ Size: 1,
+ ShareType: "25747776-08e5-494f-ab40-a64b9d20d8f7",
+ ShareTypeName: "default",
+ ConsistencyGroupID: "9397c191-8427-4661-a2e8-b23820dc01d4",
+ ProjectID: "16e1ab15c35a457e9c2b2aa189f544e1",
+ Metadata: map[string]string{
+ "project": "my_app",
+ "aim": "doc",
+ },
+ Status: "available",
+ Description: "My custom share London",
+ Host: "manila2@generic1#GENERIC1",
+ HasReplicas: false,
+ ReplicationType: "",
+ TaskState: "",
+ SnapshotSupport: true,
+ Name: "my_test_share",
+ CreatedAt: gophercloud.JSONRFC3339MilliNoZ(time.Date(
+ 2015, time.September, 18, 10, 25, 24, 0, time.UTC)),
+ ShareProto: "NFS",
+ VolumeType: "default",
+ SourceCgsnapshotMemberID: "",
+ IsPublic: true,
+ Links: []map[string]string{
+ {
+ "href": "http://172.18.198.54:8786/v2/16e1ab15c35a457e9c2b2aa189f544e1/shares/011d21e2-fbc3-4e4a-9993-9ea223f73264",
+ "rel": "self",
+ },
+ {
+ "href": "http://172.18.198.54:8786/16e1ab15c35a457e9c2b2aa189f544e1/shares/011d21e2-fbc3-4e4a-9993-9ea223f73264",
+ "rel": "bookmark",
+ },
+ },
+ })
+}