Convert try/expect/else as per new Tempest style.
Test Modified: test_create_server_when_memory_quota_is_full.
Modifications:
As per new Tempest style guidelines, convert "try/expect/else"
statements into "assertRaises".
In order to ensure that other tests remain unaffected
because of this change, replace "finally" with "addCleanup".
Blueprint update-expected-exception-tests.
Change-Id: I5a4da788fcf8269d87e1d1e5c30bc8fdbef83aec
diff --git a/tempest/tests/compute/admin/test_quotas.py b/tempest/tests/compute/admin/test_quotas.py
index 46a0c20..7f64d15 100644
--- a/tempest/tests/compute/admin/test_quotas.py
+++ b/tempest/tests/compute/admin/test_quotas.py
@@ -135,15 +135,10 @@
self.adm_client.update_quota_set(self.demo_tenant_id,
ram=mem_quota)
- try:
- self.create_server()
- except exceptions.OverLimit:
- pass
- else:
- self.fail("Could create servers over the memory quota limit")
- finally:
- self.adm_client.update_quota_set(self.demo_tenant_id,
- ram=default_mem_quota)
+
+ self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
+ ram=default_mem_quota)
+ self.assertRaises(exceptions.OverLimit, self.create_server)
#TODO(afazekas): Add test that tried to update the quota_set as a regular user