summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorWilliam Wolf <throughnothing@gmail.com>2011-08-12 13:07:24 -0400
committerWilliam Wolf <throughnothing@gmail.com>2011-08-12 13:07:24 -0400
commit3cbf0267efdef7d36a88faeb545342619f82f108 (patch)
treec81663c39757891e27de1c64a2f67ab865fb009c /nova/tests
parentcfa71424fd1724b809c0794fb4ae56f1b1c30e8a (diff)
parentbf334c786091ace63dd943e5e5893a239a22d21e (diff)
merge from trunk
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/openstack/test_common.py4
-rw-r--r--nova/tests/api/openstack/test_servers.py16
2 files changed, 20 insertions, 0 deletions
diff --git a/nova/tests/api/openstack/test_common.py b/nova/tests/api/openstack/test_common.py
index 5a6e43579..b422bc4d1 100644
--- a/nova/tests/api/openstack/test_common.py
+++ b/nova/tests/api/openstack/test_common.py
@@ -249,6 +249,10 @@ class MiscFunctionsTest(test.TestCase):
common.get_id_from_href,
fixture)
+ def test_get_id_from_href_int(self):
+ fixture = 1
+ self.assertEqual(fixture, common.get_id_from_href(fixture))
+
def test_get_version_from_href(self):
fixture = 'http://www.testsite.com/v1.1/images'
expected = '1.1'
diff --git a/nova/tests/api/openstack/test_servers.py b/nova/tests/api/openstack/test_servers.py
index f55ecbf1d..4ac1168fe 100644
--- a/nova/tests/api/openstack/test_servers.py
+++ b/nova/tests/api/openstack/test_servers.py
@@ -1653,6 +1653,22 @@ class ServersTest(test.TestCase):
res = req.get_response(fakes.wsgi_app())
self.assertEqual(res.status_int, 400)
+ def test_create_instance_v1_1_invalid_flavor_id_int(self):
+ self._setup_for_create_instance()
+
+ image_href = 'http://localhost/v1.1/images/2'
+ flavor_ref = -1
+ body = dict(server=dict(
+ name='server_test', imageRef=image_href, flavorRef=flavor_ref,
+ metadata={'hello': 'world', 'open': 'stack'},
+ personality={}))
+ req = webob.Request.blank('/v1.1/servers')
+ req.method = 'POST'
+ req.body = json.dumps(body)
+ req.headers["content-type"] = "application/json"
+ res = req.get_response(fakes.wsgi_app())
+ self.assertEqual(res.status_int, 400)
+
def test_create_instance_v1_1_bad_flavor_href(self):
self._setup_for_create_instance()