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 import objects
from watcher.tests.db import base
from watcher.tests.db import utils
@@ -66,7 +64,7 @@ class TestScoringEngineObject(base.DbTestCase):
mock_get_list.return_value = [self.fake_scoring_engine]
scoring_engines = objects.ScoringEngine.list(self.context)
self.assertEqual(1, mock_get_list.call_count, 1)
self.assertThat(scoring_engines, matchers.HasLength(1))
self.assertEqual(1, len(scoring_engines))
self.assertIsInstance(scoring_engines[0], objects.ScoringEngine)
self.assertEqual(self.context, scoring_engines[0]._context)