From abe9adf4708aa7d04ea6ff158f06dac94259ba02 Mon Sep 17 00:00:00 2001 From: Eoghan Glynn Date: Sat, 28 Jan 2012 22:29:32 +0000 Subject: Fix WADL/PDF docs referenced in describedby links These compute API links were broken, previously referring to Rackspace URLs with s/v1.0/v1.1/ The links now correctly reference long-lived locations on docs.openstack.org. Change-Id: I10efca2868a05982a1783688e374060acf1d0a69 --- Authors | 1 + nova/api/openstack/compute/versions.py | 16 ++++++-- nova/tests/api/openstack/compute/test_versions.py | 47 +++++++++++------------ 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/Authors b/Authors index 112b3b06b..3f4245979 100644 --- a/Authors +++ b/Authors @@ -52,6 +52,7 @@ Duncan McGreggor Ed Leafe Edouard Thuleau Eldar Nugaev +Eoghan Glynn Eric Day Eric Windisch Ewan Mellor diff --git a/nova/api/openstack/compute/versions.py b/nova/api/openstack/compute/versions.py index adc083caf..3ba8d80d7 100644 --- a/nova/api/openstack/compute/versions.py +++ b/nova/api/openstack/compute/versions.py @@ -24,6 +24,16 @@ from nova.api.openstack import wsgi from nova.api.openstack import xmlutil +LINKS = { + 'v2.0': { + 'pdf': 'http://docs.openstack.org/' + 'api/openstack-compute/1.1/os-compute-devguide-1.1.pdf', + 'wadl': 'http://docs.openstack.org/' + 'api/openstack-compute/1.1/wadl/os-compute-1.1.wadl', + }, +} + + VERSIONS = { "v2.0": { "id": "v2.0", @@ -33,14 +43,12 @@ VERSIONS = { { "rel": "describedby", "type": "application/pdf", - "href": "http://docs.rackspacecloud.com/" - "servers/api/v1.1/cs-devguide-20110125.pdf", + "href": LINKS['v2.0']['pdf'], }, { "rel": "describedby", "type": "application/vnd.sun.wadl+xml", - "href": "http://docs.rackspacecloud.com/" - "servers/api/v1.1/application.wadl", + "href": LINKS['v2.0']['wadl'], }, ], "media-types": [ diff --git a/nova/tests/api/openstack/compute/test_versions.py b/nova/tests/api/openstack/compute/test_versions.py index b1383be60..85c9089a0 100644 --- a/nova/tests/api/openstack/compute/test_versions.py +++ b/nova/tests/api/openstack/compute/test_versions.py @@ -37,6 +37,17 @@ NS = { 'ns': 'http://docs.openstack.org/compute/api/v1.1' } + +LINKS = { + 'v2.0': { + 'pdf': 'http://docs.openstack.org/' + 'api/openstack-compute/1.1/os-compute-devguide-1.1.pdf', + 'wadl': 'http://docs.openstack.org/' + 'api/openstack-compute/1.1/wadl/os-compute-1.1.wadl', + }, +} + + VERSIONS = { "v2.0": { "id": "v2.0", @@ -46,14 +57,12 @@ VERSIONS = { { "rel": "describedby", "type": "application/pdf", - "href": "http://docs.rackspacecloud.com/" - "servers/api/v1.1/cs-devguide-20110125.pdf", + "href": LINKS['v2.0']['pdf'], }, { "rel": "describedby", "type": "application/vnd.sun.wadl+xml", - "href": "http://docs.rackspacecloud.com/" - "servers/api/v1.1/application.wadl", + "href": LINKS['v2.0']['wadl'], }, ], "media-types": [ @@ -133,14 +142,12 @@ class VersionsTest(test.TestCase): { "rel": "describedby", "type": "application/pdf", - "href": "http://docs.rackspacecloud.com/" - "servers/api/v1.1/cs-devguide-20110125.pdf", + "href": LINKS['v2.0']['pdf'], }, { "rel": "describedby", "type": "application/vnd.sun.wadl+xml", - "href": "http://docs.rackspacecloud.com/" - "servers/api/v1.1/application.wadl", + "href": LINKS['v2.0']['wadl'], }, ], "media-types": [ @@ -179,14 +186,12 @@ class VersionsTest(test.TestCase): { "rel": "describedby", "type": "application/pdf", - "href": "http://docs.rackspacecloud.com/" - "servers/api/v1.1/cs-devguide-20110125.pdf", + "href": LINKS['v2.0']['pdf'], }, { "rel": "describedby", "type": "application/vnd.sun.wadl+xml", - "href": "http://docs.rackspacecloud.com/" - "servers/api/v1.1/application.wadl", + "href": LINKS['v2.0']['wadl'], }, ], "media-types": [ @@ -283,13 +288,11 @@ class VersionsTest(test.TestCase): self.assertEqual(entry.links[0]['href'], 'http://localhost/v2/') self.assertEqual(entry.links[0]['rel'], 'self') self.assertEqual(entry.links[1], { - 'href': 'http://docs.rackspacecloud.com/servers/api/v1.1/'\ - 'cs-devguide-20110125.pdf', + 'href': LINKS['v2.0']['pdf'], 'type': 'application/pdf', 'rel': 'describedby'}) self.assertEqual(entry.links[2], { - 'href': 'http://docs.rackspacecloud.com/servers/api/v1.1/'\ - 'application.wadl', + 'href': LINKS['v2.0']['wadl'], 'type': 'application/vnd.sun.wadl+xml', 'rel': 'describedby'}) @@ -606,14 +609,12 @@ class VersionsSerializerTests(test.TestCase): { "rel": "describedby", "type": "application/pdf", - "href": "http://docs.rackspacecloud.com/" - "servers/api/v1.1/cs-devguide-20110125.pdf", + "href": LINKS['v2.0']['pdf'], }, { "rel": "describedby", "type": "application/vnd.sun.wadl+xml", - "href": "http://docs.rackspacecloud.com/" - "servers/api/v1.1/application.wadl", + "href": LINKS['v2.0']['wadl'], }, ], "media-types": [ @@ -658,11 +659,9 @@ class VersionsSerializerTests(test.TestCase): self.assertEqual(entry.links[1], { 'rel': 'describedby', 'type': 'application/pdf', - 'href': 'http://docs.rackspacecloud.com/' - 'servers/api/v1.1/cs-devguide-20110125.pdf'}) + 'href': LINKS['v2.0']['pdf']}) self.assertEqual(entry.links[2], { 'rel': 'describedby', 'type': 'application/vnd.sun.wadl+xml', - 'href': 'http://docs.rackspacecloud.com/' - 'servers/api/v1.1/application.wadl', + 'href': LINKS['v2.0']['wadl'], }) -- cgit