diff options
| author | Brian Waldon <brian.waldon@rackspace.com> | 2011-09-12 17:52:29 -0400 |
|---|---|---|
| committer | Brian Waldon <brian.waldon@rackspace.com> | 2011-09-12 17:52:29 -0400 |
| commit | 07eb6b50c8b7ba30a5923976b66108f136f8628e (patch) | |
| tree | 70654c9f35355382de581d982aae421fcc9c97fa /nova/tests | |
| parent | 4a1db744cc812c29ebaac3180bf32fc033029513 (diff) | |
| parent | 9f39ff070b5500a0ccb9a6454995f97342254381 (diff) | |
merging trunk; resolving conflicts
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/api/openstack/fakes.py | 3 | ||||
| -rw-r--r-- | nova/tests/api/openstack/test_images.py | 130 |
2 files changed, 121 insertions, 12 deletions
diff --git a/nova/tests/api/openstack/fakes.py b/nova/tests/api/openstack/fakes.py index 80a592479..3a567f0cc 100644 --- a/nova/tests/api/openstack/fakes.py +++ b/nova/tests/api/openstack/fakes.py @@ -197,7 +197,8 @@ def _make_image_fixtures(): # Snapshot for User 1 server_ref = 'http://localhost/v1.1/servers/42' snapshot_properties = {'instance_ref': server_ref, 'user_id': 'fake'} - for status in ('queued', 'saving', 'active', 'killed'): + for status in ('queued', 'saving', 'active', 'killed', + 'deleted', 'pending_delete'): add_fixture(id=image_id, name='%s snapshot' % status, is_public=False, status=status, properties=snapshot_properties) diff --git a/nova/tests/api/openstack/test_images.py b/nova/tests/api/openstack/test_images.py index 298b7d831..7759b52ef 100644 --- a/nova/tests/api/openstack/test_images.py +++ b/nova/tests/api/openstack/test_images.py @@ -78,7 +78,9 @@ class ImagesTest(test.TestCase): {'id': '125', 'name': 'saving snapshot'}, {'id': '126', 'name': 'active snapshot'}, {'id': '127', 'name': 'killed snapshot'}, - {'id': '128', 'name': None}] + {'id': '128', 'name': 'deleted snapshot'}, + {'id': '129', 'name': 'pending_delete snapshot'}, + {'id': '130', 'name': None}] self.assertDictListMatch(response_list, expected) @@ -122,7 +124,7 @@ class ImagesTest(test.TestCase): "name": "queued snapshot", "updated": NOW_API_FORMAT, "created": NOW_API_FORMAT, - "status": "QUEUED", + "status": "SAVING", "progress": 0, 'server': { 'id': 42, @@ -174,7 +176,7 @@ class ImagesTest(test.TestCase): self.assertEqual(expected_image.toxml(), actual_image.toxml()) def test_get_image_xml_no_name(self): - request = webob.Request.blank('/v1.0/images/128') + request = webob.Request.blank('/v1.0/images/130') request.accept = "application/xml" app = fakes.wsgi_app(fake_auth_context=self._get_fake_context()) response = request.get_response(app) @@ -183,7 +185,7 @@ class ImagesTest(test.TestCase): expected_now = NOW_API_FORMAT expected_image = minidom.parseString(""" - <image id="128" + <image id="130" name="None" updated="%(expected_now)s" created="%(expected_now)s" @@ -347,7 +349,7 @@ class ImagesTest(test.TestCase): }, { "id": "128", - "name": None, + "name": "deleted snapshot", "links": [ { "rel": "self", @@ -359,6 +361,34 @@ class ImagesTest(test.TestCase): }, ], }, + { + "id": "129", + "name": "pending_delete snapshot", + "links": [ + { + "rel": "self", + "href": "http://localhost/v1.1/fake/images/129", + }, + { + "rel": "bookmark", + "href": "http://localhost/fake/images/129", + }, + ], + }, + { + "id": "130", + "name": None, + "links": [ + { + "rel": "self", + "href": "http://localhost/v1.1/fake/images/130", + }, + { + "rel": "bookmark", + "href": "http://localhost/fake/images/130", + }, + ], + }, ] self.assertDictListMatch(response_list, expected) @@ -384,7 +414,7 @@ class ImagesTest(test.TestCase): 'name': 'queued snapshot', 'updated': NOW_API_FORMAT, 'created': NOW_API_FORMAT, - 'status': 'QUEUED', + 'status': 'SAVING', 'progress': 0, }, { @@ -408,11 +438,27 @@ class ImagesTest(test.TestCase): 'name': 'killed snapshot', 'updated': NOW_API_FORMAT, 'created': NOW_API_FORMAT, - 'status': 'FAILED', + 'status': 'ERROR', 'progress': 0, }, { 'id': '128', + 'name': 'deleted snapshot', + 'updated': NOW_API_FORMAT, + 'created': NOW_API_FORMAT, + 'status': 'DELETED', + 'progress': 0, + }, + { + 'id': '129', + 'name': 'pending_delete snapshot', + 'updated': NOW_API_FORMAT, + 'created': NOW_API_FORMAT, + 'status': 'DELETED', + 'progress': 0, + }, + { + 'id': '130', 'name': None, 'updated': NOW_API_FORMAT, 'created': NOW_API_FORMAT, @@ -458,7 +504,7 @@ class ImagesTest(test.TestCase): }, 'updated': NOW_API_FORMAT, 'created': NOW_API_FORMAT, - 'status': 'QUEUED', + 'status': 'SAVING', 'progress': 0, 'server': { 'id': 42, @@ -551,7 +597,7 @@ class ImagesTest(test.TestCase): }, 'updated': NOW_API_FORMAT, 'created': NOW_API_FORMAT, - 'status': 'FAILED', + 'status': 'ERROR', 'progress': 0, 'server': { 'id': 42, @@ -575,6 +621,68 @@ class ImagesTest(test.TestCase): }, { 'id': '128', + 'name': 'deleted snapshot', + 'metadata': { + u'instance_ref': u'http://localhost/v1.1/servers/42', + u'user_id': u'fake', + }, + 'updated': NOW_API_FORMAT, + 'created': NOW_API_FORMAT, + 'status': 'DELETED', + 'progress': 0, + 'server': { + 'id': 42, + "links": [{ + "rel": "self", + "href": server_href, + }, + { + "rel": "bookmark", + "href": server_bookmark, + }], + }, + "links": [{ + "rel": "self", + "href": "http://localhost/v1.1/fake/images/128", + }, + { + "rel": "bookmark", + "href": "http://localhost/fake/images/128", + }], + }, + { + 'id': '129', + 'name': 'pending_delete snapshot', + 'metadata': { + u'instance_ref': u'http://localhost/v1.1/servers/42', + u'user_id': u'fake', + }, + 'updated': NOW_API_FORMAT, + 'created': NOW_API_FORMAT, + 'status': 'DELETED', + 'progress': 0, + 'server': { + 'id': 42, + "links": [{ + "rel": "self", + "href": server_href, + }, + { + "rel": "bookmark", + "href": server_bookmark, + }], + }, + "links": [{ + "rel": "self", + "href": "http://localhost/v1.1/fake/images/129", + }, + { + "rel": "bookmark", + "href": "http://localhost/fake/images/129", + }], + }, + { + 'id': '130', 'name': None, 'metadata': {}, 'updated': NOW_API_FORMAT, @@ -583,11 +691,11 @@ class ImagesTest(test.TestCase): 'progress': 100, "links": [{ "rel": "self", - "href": "http://localhost/v1.1/fake/images/128", + "href": "http://localhost/v1.1/fake/images/130", }, { "rel": "bookmark", - "href": "http://localhost/fake/images/128", + "href": "http://localhost/fake/images/130", }], }, ] |
