ImageService v2: Fixing Create Properties (#264)
* Fix Creating Image Properties
The combination of JSON tags were not rendering the JSON body
correctly and causing a 400 error by the API.
* ImageService v2 Acceptance Tests
* unit tests
diff --git a/openstack/imageservice/v2/images/requests.go b/openstack/imageservice/v2/images/requests.go
index 32f09ee..044b5cb 100644
--- a/openstack/imageservice/v2/images/requests.go
+++ b/openstack/imageservice/v2/images/requests.go
@@ -99,7 +99,7 @@
// properties is a set of properties, if any, that
// are associated with the image.
- Properties map[string]string `json:"-,omitempty"`
+ Properties map[string]string `json:"-"`
}
// ToImageCreateMap assembles a request body based on the contents of
diff --git a/openstack/imageservice/v2/images/testing/fixtures.go b/openstack/imageservice/v2/images/testing/fixtures.go
index 1754407..10a87b4 100644
--- a/openstack/imageservice/v2/images/testing/fixtures.go
+++ b/openstack/imageservice/v2/images/testing/fixtures.go
@@ -158,6 +158,7 @@
th.TestJSONRequest(t, r, `{
"id": "e7db3b45-8db7-47ad-8109-3fb55c2c24fd",
"name": "Ubuntu 12.10",
+ "architecture": "x86_64",
"tags": [
"ubuntu",
"quantal"
diff --git a/openstack/imageservice/v2/images/testing/requests_test.go b/openstack/imageservice/v2/images/testing/requests_test.go
index fdd8402..0371e4c 100644
--- a/openstack/imageservice/v2/images/testing/requests_test.go
+++ b/openstack/imageservice/v2/images/testing/requests_test.go
@@ -69,6 +69,9 @@
actualImage, err := images.Create(fakeclient.ServiceClient(), images.CreateOpts{
ID: id,
Name: name,
+ Properties: map[string]string{
+ "architecture": "x86_64",
+ },
Tags: []string{"ubuntu", "quantal"},
}).Extract()