summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2012-04-04 09:38:59 -0400
committerDan Prince <dprince@redhat.com>2012-04-04 09:38:59 -0400
commitc7dbed99d115989ad8d03db7dc3ffbcaa6fb78c3 (patch)
treee3053c853e1d40c06b1c44ac684c4ee781177807 /nova/tests
parentd9019f7aa6e1817d2aabcd59e7dde3d212b4e092 (diff)
Add validation on quota limits (negative numbers).
Quotas should not accept negative numbers other than -1. Fixes LP Bug #973034. Change-Id: Icc647d80df42d09928717d48ae95dfc8b76c4795
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/openstack/compute/contrib/test_quotas.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/nova/tests/api/openstack/compute/contrib/test_quotas.py b/nova/tests/api/openstack/compute/contrib/test_quotas.py
index 46753b883..ea34a4e86 100644
--- a/nova/tests/api/openstack/compute/contrib/test_quotas.py
+++ b/nova/tests/api/openstack/compute/contrib/test_quotas.py
@@ -119,6 +119,18 @@ class QuotaSetsTest(test.TestCase):
self.assertRaises(webob.exc.HTTPForbidden, self.controller.update,
req, 'update_me', body)
+ def test_quotas_update_invalid_limit(self):
+ body = {'quota_set': {'instances': -2, 'cores': -2,
+ 'ram': -2, 'volumes': -2,
+ 'gigabytes': -2, 'floating_ips': -2,
+ 'metadata_items': -2, 'injected_files': -2,
+ 'injected_file_content_bytes': -2}}
+
+ req = fakes.HTTPRequest.blank('/v2/fake4/os-quota-sets/update_me',
+ use_admin_context=True)
+ self.assertRaises(webob.exc.HTTPBadRequest, self.controller.update,
+ req, 'update_me', body)
+
class QuotaXMLSerializerTest(test.TestCase):
def setUp(self):