diff options
| author | William Wolf <throughnothing@gmail.com> | 2011-07-20 09:59:56 -0400 |
|---|---|---|
| committer | William Wolf <throughnothing@gmail.com> | 2011-07-20 09:59:56 -0400 |
| commit | 27f326c712e485322003ccdc13acfd04a6fdb119 (patch) | |
| tree | 530b1a5a80ce2fb9224de234161f516b80b0ffa7 | |
| parent | bc2747faf2164833b3e5412dd226f9ee431b1bbf (diff) | |
added 'update' field to versions
| -rw-r--r-- | nova/api/openstack/versions.py | 6 | ||||
| -rw-r--r-- | nova/api/openstack/views/versions.py | 1 | ||||
| -rw-r--r-- | nova/tests/api/openstack/test_versions.py | 9 |
3 files changed, 13 insertions, 3 deletions
diff --git a/nova/api/openstack/versions.py b/nova/api/openstack/versions.py index 450b42765..1b1fc41ab 100644 --- a/nova/api/openstack/versions.py +++ b/nova/api/openstack/versions.py @@ -45,10 +45,14 @@ class Versions(wsgi.Resource): { "id": "v1.1", "status": "CURRENT", + #TODO(wwolf) get correct value for these + "updated": "2011-7-18T11:30:00Z", }, { "id": "v1.0", "status": "DEPRECATED", + #TODO(wwolf) get correct value for these + "updated": "2010-10-09T11:30:00Z", }, ] @@ -72,7 +76,7 @@ class VersionsXMLSerializer(wsgi.XMLDictSerializer): version_node = self.xml_doc.createElement('version') version_node.setAttribute('id', version['id']) version_node.setAttribute('status', version['status']) - #TODO(wwolf) need 'updated' attribute too + version_node.setAttribute('updated', version['updated']) for link in version['links']: link_node = self.xml_doc.createElement('atom:link') diff --git a/nova/api/openstack/views/versions.py b/nova/api/openstack/views/versions.py index d0145c94a..e815974f1 100644 --- a/nova/api/openstack/views/versions.py +++ b/nova/api/openstack/views/versions.py @@ -36,6 +36,7 @@ class ViewBuilder(object): version = { "id": version_data["id"], "status": version_data["status"], + "updated": version_data["updated"], "links": self._build_links(version_data), } diff --git a/nova/tests/api/openstack/test_versions.py b/nova/tests/api/openstack/test_versions.py index ff6298640..32c57057a 100644 --- a/nova/tests/api/openstack/test_versions.py +++ b/nova/tests/api/openstack/test_versions.py @@ -43,6 +43,7 @@ class VersionsTest(test.TestCase): { "id": "v1.1", "status": "CURRENT", + "updated": "2011-7-18T11:30:00Z", "links": [ { "rel": "self", @@ -52,6 +53,7 @@ class VersionsTest(test.TestCase): { "id": "v1.0", "status": "DEPRECATED", + "updated": "2010-10-09T11:30:00Z", "links": [ { "rel": "self", @@ -69,10 +71,11 @@ class VersionsTest(test.TestCase): self.assertEqual(res.content_type, "application/xml") expected = """<versions> - <version id="v1.1" status="CURRENT"> + <version id="v1.1" status="CURRENT" updated="2011-7-18T11:30:00Z"> <atom:link href="http://localhost/v1.1" rel="self"/> </version> - <version id="v1.0" status="DEPRECATED"> + <version id="v1.0" status="DEPRECATED" + updated="2010-10-09T11:30:00Z"> <atom:link href="http://localhost/v1.0" rel="self"/> </version> </versions>""".replace(" ", "").replace("\n", "") @@ -87,11 +90,13 @@ class VersionsTest(test.TestCase): version_data = { "id": "3.2.1", "status": "CURRENT", + "updated": "2011-7-18T11:30:00Z" } expected = { "id": "3.2.1", "status": "CURRENT", + "updated": "2011-7-18T11:30:00Z", "links": [ { "rel": "self", |
