From e07e9d936665d4c7e58edc30e2746544ce4fa784 Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Mon, 24 Mar 2014 14:58:47 +0200 Subject: [PATCH] Use correct order of arguments to assertEqual The correct order of arguments to assertEqual that is expected by testtools is (expected, observed). This patch fixes the inverted usage of arguments in some places that have cropped up since the last fix of this bug. Change-Id: Ifbc5da5cba0c8dcdf5b9c9eb6e6bfb1b1c2b49b0 Closes-Bug: #1259292 --- heatclient/tests/test_common_http.py | 10 +++++----- heatclient/tests/test_template_utils.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/heatclient/tests/test_common_http.py b/heatclient/tests/test_common_http.py index 301b6653..a2b4b502 100644 --- a/heatclient/tests/test_common_http.py +++ b/heatclient/tests/test_common_http.py @@ -480,8 +480,8 @@ class HttpClientTest(testtools.TestCase): self.m.ReplayAll() client = http.HTTPClient('http://example.com:8004') resp, body = client.json_request('GET', '') - self.assertEqual(resp.status_code, 200) - self.assertEqual(body, {}) + self.assertEqual(200, resp.status_code) + self.assertEqual({}, body) self.m.VerifyAll() def test_http_404_json_request(self): @@ -617,7 +617,7 @@ class HttpClientTest(testtools.TestCase): self.m.ReplayAll() ca = http.get_system_ca_file() - self.assertEqual(ca, chosen) + self.assertEqual(chosen, ca) self.m.VerifyAll() @@ -627,13 +627,13 @@ class HttpClientTest(testtools.TestCase): def test_passed_cert_to_verify_cert(self): client = http.HTTPClient('https://foo', ca_file="NOWHERE") - self.assertEqual(client.verify_cert, "NOWHERE") + self.assertEqual("NOWHERE", client.verify_cert) self.m.StubOutWithMock(http, 'get_system_ca_file') http.get_system_ca_file().AndReturn("SOMEWHERE") self.m.ReplayAll() client = http.HTTPClient('https://foo') - self.assertEqual(client.verify_cert, "SOMEWHERE") + self.assertEqual("SOMEWHERE", client.verify_cert) def test_curl_log_i18n_headers(self): self.m.StubOutWithMock(logging.Logger, 'debug') diff --git a/heatclient/tests/test_template_utils.py b/heatclient/tests/test_template_utils.py index 951dcad8..bd10db0e 100644 --- a/heatclient/tests/test_template_utils.py +++ b/heatclient/tests/test_template_utils.py @@ -293,17 +293,17 @@ class TestGetTemplateContents(testtools.TestCase): template_utils.get_template_contents, tmpl_file.name) self.assertEqual( - str(ex), - 'Could not fetch template from file://%s' % tmpl_file.name) + 'Could not fetch template from file://%s' % tmpl_file.name, + str(ex)) def test_get_template_contents_file_none(self): ex = self.assertRaises( exc.CommandError, template_utils.get_template_contents) self.assertEqual( - str(ex), ('Need to specify exactly one of --template-file, ' - '--template-url or --template-object')) + '--template-url or --template-object'), + str(ex)) def test_get_template_contents_parse_error(self): with tempfile.NamedTemporaryFile() as tmpl_file: