HasLength() rewritten to assertEqual()

HasLength() based assertions are re-written to assertEqual() based
assertion to homogenize the test code base.

For example:

assertThat(.., HasLength()) becomes assertEqual(len(),...)

Change-Id: Ia3bf24e34fffe445ff4b0ee61fb7cbc0eb36a57a
Closes-Bug:#1629898
This commit is contained in:
haris tanvir
2016-10-03 21:15:24 +05:00
parent 2642627da6
commit db3b5b30b2
6 changed files with 6 additions and 18 deletions

View File

@@ -14,8 +14,6 @@
# under the License.
import mock
from testtools import matchers
from watcher.common import exception
# from watcher.common import utils as w_utils
from watcher import objects
@@ -58,7 +56,7 @@ class TestAuditObject(base.DbTestCase):
mock_get_list.return_value = [self.fake_audit]
audits = objects.Audit.list(self.context)
self.assertEqual(1, mock_get_list.call_count, 1)
self.assertThat(audits, matchers.HasLength(1))
self.assertEqual(1, len(audits))
self.assertIsInstance(audits[0], objects.Audit)
self.assertEqual(self.context, audits[0]._context)