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
This commit is contained in:
Pavlo Shchelokovskyy 2014-03-24 14:58:47 +02:00
parent 7a85f8ba8a
commit e07e9d9366
2 changed files with 9 additions and 9 deletions

View File

@ -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')

View File

@ -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: