From 72a0a7c174f2ba0787defc10af6f67403a705647 Mon Sep 17 00:00:00 2001 From: Michal Pryc Date: Fri, 15 Apr 2016 16:16:16 +0200 Subject: [PATCH] Fixes unexpectedly passing functional test. This fix allows all functional tests passing rather then one unexpectedly passing: test_bug_1541691.TestServerValidation.test_name_validation The bug 1541691 was merged, however test never got updated. Change-Id: I84597ad5f5ca9ef457f34769e3fe299b780acadd Closes-Bug: 1570884 Related-Bug: 1541691 --- .../regressions/test_bug_1541691.py | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/nova/tests/functional/regressions/test_bug_1541691.py b/nova/tests/functional/regressions/test_bug_1541691.py index 49214ff81f..49613e7a96 100644 --- a/nova/tests/functional/regressions/test_bug_1541691.py +++ b/nova/tests/functional/regressions/test_bug_1541691.py @@ -55,19 +55,7 @@ class TestServerValidation(test.TestCase): server = dict(name='server1 ', imageRef=self.image_id, flavorRef=self.flavor_id) - try: - self.api.post_server({'server': server}) - except client.OpenStackApiException as osae: - # We expect this to be a 400 error with validation problems. - self.assertEqual(400, osae.response.status_code) - # NOTE(sdague): using expectFailure means we can land this - # test while the bug still exists, then fix it after. - self.expectFailure( - "This is expected to fail until bug 1541691 is fixed", - self.assertLess, - len(osae.response.content), - 1000, - "The length of the error response is > 1k. Something is " - "wrong.") - return - self.fail("We should have thrown a 400 error") + + server_args = {'server': server} + self.assertRaises(client.OpenStackApiException, self.api.post_server, + server_args)