Add negative test in test_quotas.py.

This adds test for creating server when there is no more available instance quota
Fixes bug 1131112

Change-Id: I2a067ac73c1f1aeb25fca98fb84e3eaebbe7951e
diff --git a/tempest/tests/compute/admin/test_quotas.py b/tempest/tests/compute/admin/test_quotas.py
index a845632..9fff2fa 100644
--- a/tempest/tests/compute/admin/test_quotas.py
+++ b/tempest/tests/compute/admin/test_quotas.py
@@ -149,6 +149,19 @@
 
 #TODO(afazekas): Add test that tried to update the quota_set as a regular user
 
+    @attr(type='negative')
+    def test_create_server_when_instances_quota_is_full(self):
+        #Once instances quota limit is reached, disallow server creation
+        resp, quota_set = self.client.get_quota_set(self.demo_tenant_id)
+        default_instances_quota = quota_set['instances']
+        instances_quota = 0  # Set quota to zero to disallow server creation
+
+        self.adm_client.update_quota_set(self.demo_tenant_id,
+                                         instances=instances_quota)
+        self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
+                        instances=default_instances_quota)
+        self.assertRaises(exceptions.OverLimit, self.create_server)
+
 
 class QuotasAdminTestJSON(QuotasAdminTestBase, base.BaseComputeAdminTestJSON,
                           base.BaseComputeTest):