diff options
author | Julien Danjou <julien@danjou.info> | 2016-06-22 10:05:42 +0200 |
---|---|---|
committer | Julien Danjou <julien@danjou.info> | 2016-06-22 10:08:29 +0200 |
commit | 4c82261f6aef43b960797cc6a4fd59a5265b8f4c (patch) | |
tree | 543ac008b3bd40ec9604496e3e34ef872358564a | |
parent | 1579c7ce1526a952d74faeaad3e0ad1719604221 (diff) | |
download | oslo-db-4c82261f6aef43b960797cc6a4fd59a5265b8f4c.tar.gz |
tests: fix order of assertEqual in exc_filter
The order are inversed, which means that on failure, debugging message is not
inverted and very confusing until you realize that "expected" is "actual" and
"actual" is "expected.
Let's avoid that confusion and fix it altogether!
Change-Id: I15277c4d272d2c129a7629407e3bcef2a42ea7ef
-rw-r--r-- | oslo_db/tests/sqlalchemy/test_exc_filters.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/oslo_db/tests/sqlalchemy/test_exc_filters.py b/oslo_db/tests/sqlalchemy/test_exc_filters.py index 4593c04..ac9e35f 100644 --- a/oslo_db/tests/sqlalchemy/test_exc_filters.py +++ b/oslo_db/tests/sqlalchemy/test_exc_filters.py @@ -45,26 +45,26 @@ class _SQLAExceptionMatcher(object): if isinstance(exception_type, (type, tuple)): self.assertTrue(issubclass(exc.__class__, exception_type)) else: - self.assertEqual(exc.__class__.__name__, exception_type) + self.assertEqual(exception_type, exc.__class__.__name__) if isinstance(message, tuple): self.assertEqual( + [m.lower() + if isinstance(m, six.string_types) else m for m in message], [a.lower() if isinstance(a, six.string_types) else a - for a in exc.orig.args], - [m.lower() - if isinstance(m, six.string_types) else m for m in message] + for a in exc.orig.args] ) else: - self.assertEqual(str(exc.orig).lower(), message.lower()) + self.assertEqual(message.lower(), str(exc.orig).lower()) if sql is not None: if params is not None: if '?' in exc.statement: - self.assertEqual(exc.statement, sql) - self.assertEqual(exc.params, params) + self.assertEqual(sql, exc.statement) + self.assertEqual(params, exc.params) else: - self.assertEqual(exc.statement % exc.params, sql % params) + self.assertEqual(sql % params, exc.statement % exc.params) else: - self.assertEqual(exc.statement, sql) + self.assertEqual(sql, exc.statement) class TestsExceptionFilter(_SQLAExceptionMatcher, oslo_test_base.BaseTestCase): |