summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJosh Kearney <josh@jk0.org>2011-06-24 11:55:43 -0500
committerJosh Kearney <josh@jk0.org>2011-06-24 11:55:43 -0500
commitcbf9f1bef113d54be57e2bb9a79990226afcd90f (patch)
treefbdec79d7174106fa920122bb737e66c7d010a21 /nova/tests
parent4a32c971893a22a6451eed7e618291ad86c24510 (diff)
Adding tests for backup no rotation, invalid image type
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/openstack/test_images.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/nova/tests/api/openstack/test_images.py b/nova/tests/api/openstack/test_images.py
index 036e510c9..0fad044f1 100644
--- a/nova/tests/api/openstack/test_images.py
+++ b/nova/tests/api/openstack/test_images.py
@@ -1018,6 +1018,35 @@ class ImageControllerWithGlanceServiceTest(test.TestCase):
response = req.get_response(fakes.wsgi_app())
self.assertEqual(200, response.status_int)
+ def test_create_backup_no_rotation(self):
+ """Rotation is required for backup requests"""
+ # FIXME(sirp): teardown needed?
+ FLAGS.allow_admin_api = True
+
+ # FIXME(sirp): should the fact that backups are admin_only be a FLAG
+ body = dict(image=dict(serverId='123', image_type='daily'))
+ req = webob.Request.blank('/v1.0/images')
+ req.method = 'POST'
+ req.body = json.dumps(body)
+ req.headers["content-type"] = "application/json"
+ response = req.get_response(fakes.wsgi_app())
+ self.assertEqual(400, response.status_int)
+
+ def test_create_image_with_invalid_image_type(self):
+ """Valid image_types are snapshot | daily | weekly"""
+ # FIXME(sirp): teardown needed?
+ FLAGS.allow_admin_api = True
+
+ # FIXME(sirp): should the fact that backups are admin_only be a FLAG
+ body = dict(image=dict(serverId='123', image_type='monthly',
+ rotation=1))
+ req = webob.Request.blank('/v1.0/images')
+ req.method = 'POST'
+ req.body = json.dumps(body)
+ req.headers["content-type"] = "application/json"
+ response = req.get_response(fakes.wsgi_app())
+ self.assertEqual(400, response.status_int)
+
def test_create_image_no_server_id(self):
body = dict(image=dict(name='Snapshot 1'))