diff options
| author | Brian Waldon <brian.waldon@rackspace.com> | 2011-03-16 16:58:38 -0400 |
|---|---|---|
| committer | Brian Waldon <brian.waldon@rackspace.com> | 2011-03-16 16:58:38 -0400 |
| commit | bb606c7ba42fc567f2e9989e0f560783743e5ddd (patch) | |
| tree | 9496ba6a3544d9ca7824ad047fee0572517db99c | |
| parent | 77a48cdd8a22cc84ed67a6b3d1c3793dd93e44a8 (diff) | |
| download | nova-bb606c7ba42fc567f2e9989e0f560783743e5ddd.tar.gz nova-bb606c7ba42fc567f2e9989e0f560783743e5ddd.tar.xz nova-bb606c7ba42fc567f2e9989e0f560783743e5ddd.zip | |
adding bookmarks links to 1.1 flavor entities
| -rw-r--r-- | nova/api/openstack/views/flavors.py | 13 | ||||
| -rw-r--r-- | nova/tests/api/openstack/test_flavors.py | 50 |
2 files changed, 62 insertions, 1 deletions
diff --git a/nova/api/openstack/views/flavors.py b/nova/api/openstack/views/flavors.py index 19ac8f114..be7e68763 100644 --- a/nova/api/openstack/views/flavors.py +++ b/nova/api/openstack/views/flavors.py @@ -76,10 +76,21 @@ class ViewBuilder_1_1(ViewBuilder): return flavor_obj def _build_links(self, flavor_obj): + href = self.generate_href(flavor_obj["id"]) links = [ { "rel": "self", - "href": self.generate_href(flavor_obj["id"]), + "href": href, + }, + { + "rel": "bookmark", + "type": "application/json", + "href": href, + }, + { + "rel": "bookmark", + "type": "application/xml", + "href": href, }, ] return links diff --git a/nova/tests/api/openstack/test_flavors.py b/nova/tests/api/openstack/test_flavors.py index 197e907c4..8dfcfe293 100644 --- a/nova/tests/api/openstack/test_flavors.py +++ b/nova/tests/api/openstack/test_flavors.py @@ -143,6 +143,16 @@ class FlavorsTest(test.TestCase): "rel": "self", "href": "http://localhost/v1.1/flavors/12", }, + { + "rel": "bookmark", + "type": "application/json", + "href": "http://localhost/v1.1/flavors/12", + }, + { + "rel": "bookmark", + "type": "application/xml", + "href": "http://localhost/v1.1/flavors/12", + }, ], } self.assertEqual(flavor, expected) @@ -162,6 +172,16 @@ class FlavorsTest(test.TestCase): "rel": "self", "href": "http://localhost/v1.1/flavors/1", }, + { + "rel": "bookmark", + "type": "application/json", + "href": "http://localhost/v1.1/flavors/1", + }, + { + "rel": "bookmark", + "type": "application/xml", + "href": "http://localhost/v1.1/flavors/1", + }, ], }, { @@ -172,6 +192,16 @@ class FlavorsTest(test.TestCase): "rel": "self", "href": "http://localhost/v1.1/flavors/2", }, + { + "rel": "bookmark", + "type": "application/json", + "href": "http://localhost/v1.1/flavors/2", + }, + { + "rel": "bookmark", + "type": "application/xml", + "href": "http://localhost/v1.1/flavors/2", + }, ], }, ] @@ -194,6 +224,16 @@ class FlavorsTest(test.TestCase): "rel": "self", "href": "http://localhost/v1.1/flavors/1", }, + { + "rel": "bookmark", + "type": "application/json", + "href": "http://localhost/v1.1/flavors/1", + }, + { + "rel": "bookmark", + "type": "application/xml", + "href": "http://localhost/v1.1/flavors/1", + }, ], }, { @@ -206,6 +246,16 @@ class FlavorsTest(test.TestCase): "rel": "self", "href": "http://localhost/v1.1/flavors/2", }, + { + "rel": "bookmark", + "type": "application/json", + "href": "http://localhost/v1.1/flavors/2", + }, + { + "rel": "bookmark", + "type": "application/xml", + "href": "http://localhost/v1.1/flavors/2", + }, ], }, ] |
