summaryrefslogtreecommitdiff
path: root/neutronclient/tests/unit/test_cli20.py
diff options
context:
space:
mode:
authorreedip <reedip.banerjee@nectechnologies.in>2016-02-19 12:56:21 +0900
committerReedip <reedip.banerjee@nectechnologies.in>2016-04-11 07:06:05 +0000
commitfc2950c2bb6ababef650e20ebefa2c3f1b46fa1a (patch)
treec46b760416e975e6ec3d77880e78697cece0aed2 /neutronclient/tests/unit/test_cli20.py
parent97ed202387dc16d397047f6a8c8519a2990a4767 (diff)
downloadpython-neutronclient-4.2.0.tar.gz
Change try..except to assertRaises in UT4.2.0
Following patch changes the try..except condition for testing to assertRaises. Change-Id: I2253b4e75f778ad077bd905487ede075a430a1fa
Diffstat (limited to 'neutronclient/tests/unit/test_cli20.py')
-rw-r--r--neutronclient/tests/unit/test_cli20.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/neutronclient/tests/unit/test_cli20.py b/neutronclient/tests/unit/test_cli20.py
index 725e80f..c5b5709 100644
--- a/neutronclient/tests/unit/test_cli20.py
+++ b/neutronclient/tests/unit/test_cli20.py
@@ -695,13 +695,10 @@ class ClientV2TestJson(CLITestV20Base):
def test_do_request_with_long_uri_exception(self):
long_string = 'x' * 8200 # 8200 > MAX_URI_LEN:8192
params = {'id': long_string}
-
- try:
- self.client.do_request('GET', '/test', body='', params=params)
- except exceptions.RequestURITooLong as cm:
- self.assertNotEqual(0, cm.excess)
- else:
- self.fail('Expected exception NOT raised')
+ exception = self.assertRaises(exceptions.RequestURITooLong,
+ self.client.do_request,
+ 'GET', '/test', body='', params=params)
+ self.assertNotEqual(0, exception.excess)
def test_do_request_request_ids(self):
self.mox.StubOutWithMock(self.client.httpclient, "request")