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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user