Fix order of arguments in assertEqual

Some tests used incorrect order assertEqual(observed, expected).

The correct order expected by testtools is
assertEqual(expected, observed).

Change-Id: I1184cb9f163ffb6416be32ddb1386c3bfd9b1006
Closes-Bug: #1259292
This commit is contained in:
Pavlo Shchelokovskyy
2013-12-25 16:36:02 +02:00
committed by Gerrit Code Review
parent 884d5403bc
commit 4665d685f5
3 changed files with 25 additions and 25 deletions

View File

@@ -46,8 +46,8 @@ class HttpClientTest(testtools.TestCase):
self.m.ReplayAll()
client = http.HTTPClient('http://example.com:8004')
resp, body = client.raw_request('GET', '')
self.assertEqual(resp.status, 200)
self.assertEqual(''.join([x for x in body]), '')
self.assertEqual(200, resp.status)
self.assertEqual('', ''.join([x for x in body]))
self.m.VerifyAll()
def test_token_or_credentials(self):
@@ -88,16 +88,16 @@ class HttpClientTest(testtools.TestCase):
self.m.ReplayAll()
client = http.HTTPClient('http://example.com:8004')
resp, body = client.raw_request('GET', '')
self.assertEqual(resp.status, 200)
self.assertEqual(200, resp.status)
client.username = 'user'
client.password = 'pass'
resp, body = client.raw_request('GET', '')
self.assertEqual(resp.status, 200)
self.assertEqual(200, resp.status)
client.auth_token = 'abcd1234'
resp, body = client.raw_request('GET', '')
self.assertEqual(resp.status, 200)
self.assertEqual(200, resp.status)
self.m.VerifyAll()
def test_include_pass(self):
@@ -196,7 +196,7 @@ class HttpClientTest(testtools.TestCase):
client = http.HTTPClient('http://example.com:8004')
client.region_name = 'RegionOne'
resp, body = client.raw_request('GET', '')
self.assertEqual(resp.status, 200)
self.assertEqual(200, resp.status)
self.m.VerifyAll()
def test_http_json_request(self):
@@ -216,8 +216,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, 200)
self.assertEqual(body, {})
self.assertEqual(200, resp.status)
self.assertEqual({}, body)
self.m.VerifyAll()
def test_http_json_request_w_req_body(self):
@@ -237,8 +237,8 @@ class HttpClientTest(testtools.TestCase):
self.m.ReplayAll()
client = http.HTTPClient('http://example.com:8004')
resp, body = client.json_request('GET', '', body='test-body')
self.assertEqual(resp.status, 200)
self.assertEqual(body, {})
self.assertEqual(200, resp.status)
self.assertEqual({}, body)
self.m.VerifyAll()
def test_http_json_request_non_json_resp_cont_type(self):
@@ -258,7 +258,7 @@ class HttpClientTest(testtools.TestCase):
self.m.ReplayAll()
client = http.HTTPClient('http://example.com:8004')
resp, body = client.json_request('GET', '', body='test-body')
self.assertEqual(resp.status, 200)
self.assertEqual(200, resp.status)
self.assertIsNone(body)
self.m.VerifyAll()
@@ -279,8 +279,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, 200)
self.assertEqual(body, 'invalid-json')
self.assertEqual(200, resp.status)
self.assertEqual('invalid-json', body)
self.m.VerifyAll()
def test_http_json_request_redirect(self):
@@ -312,8 +312,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, 200)
self.assertEqual(body, {})
self.assertEqual(200, resp.status)
self.assertEqual({}, body)
self.m.VerifyAll()
def test_http_json_request_prohibited_redirect(self):
@@ -399,8 +399,8 @@ class HttpClientTest(testtools.TestCase):
# cert_file='dummy',
# key_file='dummy')
# resp, body = client.json_request('GET', '')
# self.assertEqual(resp.status, 200)
# self.assertEqual(body, {})
# self.assertEqual(200, resp.status)
# self.assertEqual({}, body)
# self.m.VerifyAll()
def test_fake_json_request(self):

View File

@@ -34,7 +34,7 @@ resource_registry: {}
tpl1 = environment_format.parse(yaml1)
environment_format.default_for_missing(tpl1)
tpl2 = environment_format.parse(yaml2)
self.assertEqual(tpl1, tpl2)
self.assertEqual(tpl2, tpl1)
def test_wrong_sections(self):
env = '''

View File

@@ -246,7 +246,7 @@ class ShellBase(TestCase):
_shell.main(argstr.split())
except SystemExit:
exc_type, exc_value, exc_traceback = sys.exc_info()
self.assertEqual(exc_value.code, 0)
self.assertEqual(0, exc_value.code)
finally:
out = sys.stdout.getvalue()
sys.stdout.close()
@@ -398,7 +398,7 @@ class ShellTestUserPass(ShellBase):
try:
self.shell("stack-show bad")
except exc.HTTPException as e:
self.assertEqual(str(e), "ERROR: " + message)
self.assertEqual("ERROR: " + message, str(e))
def test_parsable_verbose(self):
message = "The Stack (bad) could not be found."
@@ -424,7 +424,7 @@ class ShellTestUserPass(ShellBase):
self.shell("stack-show bad")
except exc.HTTPException as e:
expect = 'ERROR: The Stack (bad) could not be found.\n<TRACEBACK>'
self.assertEqual(str(e), expect)
self.assertEqual(expect, str(e))
def test_parsable_malformed_error(self):
invalid_json = "ERROR: {Invalid JSON Error."
@@ -435,7 +435,7 @@ class ShellTestUserPass(ShellBase):
try:
self.shell("stack-show bad")
except exc.HTTPException as e:
self.assertEqual(str(e), "ERROR: " + invalid_json)
self.assertEqual("ERROR: " + invalid_json, str(e))
def test_parsable_malformed_error_missing_message(self):
missing_message = {
@@ -455,7 +455,7 @@ class ShellTestUserPass(ShellBase):
try:
self.shell("stack-show bad")
except exc.HTTPException as e:
self.assertEqual(str(e), "ERROR: Internal Error")
self.assertEqual("ERROR: Internal Error", str(e))
def test_parsable_malformed_error_missing_traceback(self):
message = "The Stack (bad) could not be found."
@@ -478,8 +478,8 @@ class ShellTestUserPass(ShellBase):
try:
self.shell("stack-show bad")
except exc.HTTPException as e:
self.assertEqual(str(e),
"ERROR: The Stack (bad) could not be found.\n")
self.assertEqual("ERROR: The Stack (bad) could not be found.\n",
str(e))
def test_stack_show(self):
self._script_keystone_client()