Clean imports in code

This patch set modifies lines which are importing objects
instead of modules. As per openstack import guide lines, user should
import modules in a file not objects.

http://docs.openstack.org/developer/hacking/#imports

Change-Id: I17e692108c058ba393eb2a81b8814f879956a991
This commit is contained in:
Cao Xuan Hoang
2016-09-06 10:57:31 +07:00
parent 465d0d46a3
commit 4df180fc1f
7 changed files with 21 additions and 21 deletions

View File

@@ -18,7 +18,7 @@
import copy import copy
import testtools import testtools
from testtools.matchers import HasLength from testtools import matchers
from watcherclient.tests import utils from watcherclient.tests import utils
import watcherclient.v1.action import watcherclient.v1.action
@@ -210,7 +210,7 @@ class ActionManagerTest(testtools.TestCase):
('GET', '/v1/actions/?limit=1', {}, None), ('GET', '/v1/actions/?limit=1', {}, None),
] ]
self.assertEqual(expect, self.api.calls) self.assertEqual(expect, self.api.calls)
self.assertThat(actions, HasLength(1)) self.assertThat(actions, matchers.HasLength(1))
def test_actions_list_pagination_no_limit(self): def test_actions_list_pagination_no_limit(self):
self.api = utils.FakeAPI(fake_responses_pagination) self.api = utils.FakeAPI(fake_responses_pagination)
@@ -221,7 +221,7 @@ class ActionManagerTest(testtools.TestCase):
('GET', '/v1/actions/?limit=1', {}, None) ('GET', '/v1/actions/?limit=1', {}, None)
] ]
self.assertEqual(expect, self.api.calls) self.assertEqual(expect, self.api.calls)
self.assertThat(actions, HasLength(2)) self.assertThat(actions, matchers.HasLength(2))
def test_actions_list_sort_key(self): def test_actions_list_sort_key(self):
self.api = utils.FakeAPI(fake_responses_sorting) self.api = utils.FakeAPI(fake_responses_sorting)

View File

@@ -18,7 +18,7 @@
import copy import copy
import testtools import testtools
from testtools.matchers import HasLength from testtools import matchers
from watcherclient.tests import utils from watcherclient.tests import utils
import watcherclient.v1.action_plan import watcherclient.v1.action_plan
@@ -147,7 +147,7 @@ class ActionPlanManagerTest(testtools.TestCase):
('GET', '/v1/action_plans/?limit=1', {}, None), ('GET', '/v1/action_plans/?limit=1', {}, None),
] ]
self.assertEqual(expect, self.api.calls) self.assertEqual(expect, self.api.calls)
self.assertThat(action_plans, HasLength(1)) self.assertThat(action_plans, matchers.HasLength(1))
def test_action_plans_list_pagination_no_limit(self): def test_action_plans_list_pagination_no_limit(self):
self.api = utils.FakeAPI(fake_responses_pagination) self.api = utils.FakeAPI(fake_responses_pagination)
@@ -158,7 +158,7 @@ class ActionPlanManagerTest(testtools.TestCase):
('GET', '/v1/action_plans/?limit=1', {}, None) ('GET', '/v1/action_plans/?limit=1', {}, None)
] ]
self.assertEqual(expect, self.api.calls) self.assertEqual(expect, self.api.calls)
self.assertThat(action_plans, HasLength(2)) self.assertThat(action_plans, matchers.HasLength(2))
def test_action_plans_list_sort_key(self): def test_action_plans_list_sort_key(self):
self.api = utils.FakeAPI(fake_responses_sorting) self.api = utils.FakeAPI(fake_responses_sorting)

View File

@@ -18,7 +18,7 @@
import copy import copy
import testtools import testtools
from testtools.matchers import HasLength from testtools import matchers
from watcherclient.tests import utils from watcherclient.tests import utils
import watcherclient.v1.audit import watcherclient.v1.audit
@@ -160,7 +160,7 @@ class AuditManagerTest(testtools.TestCase):
('GET', '/v1/audits/?limit=1', {}, None), ('GET', '/v1/audits/?limit=1', {}, None),
] ]
self.assertEqual(expect, self.api.calls) self.assertEqual(expect, self.api.calls)
self.assertThat(audits, HasLength(1)) self.assertThat(audits, matchers.HasLength(1))
def test_audits_list_pagination_no_limit(self): def test_audits_list_pagination_no_limit(self):
self.api = utils.FakeAPI(fake_responses_pagination) self.api = utils.FakeAPI(fake_responses_pagination)
@@ -171,7 +171,7 @@ class AuditManagerTest(testtools.TestCase):
('GET', '/v1/audits/?limit=1', {}, None) ('GET', '/v1/audits/?limit=1', {}, None)
] ]
self.assertEqual(expect, self.api.calls) self.assertEqual(expect, self.api.calls)
self.assertThat(audits, HasLength(2)) self.assertThat(audits, matchers.HasLength(2))
def test_audits_list_sort_key(self): def test_audits_list_sort_key(self):
self.api = utils.FakeAPI(fake_responses_sorting) self.api = utils.FakeAPI(fake_responses_sorting)

View File

@@ -17,7 +17,7 @@
import testtools import testtools
from testtools.matchers import HasLength from testtools import matchers
from watcherclient.tests import utils from watcherclient.tests import utils
import watcherclient.v1.goal import watcherclient.v1.goal
@@ -132,7 +132,7 @@ class GoalManagerTest(testtools.TestCase):
('GET', '/v1/goals/?limit=1', {}, None), ('GET', '/v1/goals/?limit=1', {}, None),
] ]
self.assertEqual(expect, self.api.calls) self.assertEqual(expect, self.api.calls)
self.assertThat(goals, HasLength(1)) self.assertThat(goals, matchers.HasLength(1))
def test_goals_list_pagination_no_limit(self): def test_goals_list_pagination_no_limit(self):
self.api = utils.FakeAPI(fake_responses_pagination) self.api = utils.FakeAPI(fake_responses_pagination)
@@ -143,7 +143,7 @@ class GoalManagerTest(testtools.TestCase):
('GET', '/v1/goals/?limit=1', {}, None) ('GET', '/v1/goals/?limit=1', {}, None)
] ]
self.assertEqual(expect, self.api.calls) self.assertEqual(expect, self.api.calls)
self.assertThat(goals, HasLength(2)) self.assertThat(goals, matchers.HasLength(2))
def test_goals_list_sort_key(self): def test_goals_list_sort_key(self):
self.api = utils.FakeAPI(fake_responses_sorting) self.api = utils.FakeAPI(fake_responses_sorting)

View File

@@ -18,7 +18,7 @@
import copy import copy
import testtools import testtools
from testtools.matchers import HasLength from testtools import matchers
from watcherclient.tests import utils from watcherclient.tests import utils
import watcherclient.v1.metric_collector import watcherclient.v1.metric_collector
@@ -240,7 +240,7 @@ class MetricCollectorManagerTest(testtools.TestCase):
('GET', '/v1/metric-collectors/?limit=1', {}, None), ('GET', '/v1/metric-collectors/?limit=1', {}, None),
] ]
self.assertEqual(expect, self.api.calls) self.assertEqual(expect, self.api.calls)
self.assertThat(metric_collectors, HasLength(1)) self.assertThat(metric_collectors, matchers.HasLength(1))
def test_metric_collectors_list_pagination_no_limit(self): def test_metric_collectors_list_pagination_no_limit(self):
self.api = utils.FakeAPI(fake_responses_pagination) self.api = utils.FakeAPI(fake_responses_pagination)
@@ -252,7 +252,7 @@ class MetricCollectorManagerTest(testtools.TestCase):
('GET', '/v1/metric-collectors/?limit=1', {}, None) ('GET', '/v1/metric-collectors/?limit=1', {}, None)
] ]
self.assertEqual(expect, self.api.calls) self.assertEqual(expect, self.api.calls)
self.assertThat(metric_collectors, HasLength(2)) self.assertThat(metric_collectors, matchers.HasLength(2))
def test_metric_collectors_list_sort_key(self): def test_metric_collectors_list_sort_key(self):
self.api = utils.FakeAPI(fake_responses_sorting) self.api = utils.FakeAPI(fake_responses_sorting)

View File

@@ -16,7 +16,7 @@
import testtools import testtools
from testtools.matchers import HasLength from testtools import matchers
from watcherclient.tests import utils from watcherclient.tests import utils
import watcherclient.v1.scoring_engine import watcherclient.v1.scoring_engine
@@ -133,7 +133,7 @@ class ScoringEngineManagerTest(testtools.TestCase):
('GET', '/v1/scoring_engines/?limit=1', {}, None), ('GET', '/v1/scoring_engines/?limit=1', {}, None),
] ]
self.assertEqual(expect, self.api.calls) self.assertEqual(expect, self.api.calls)
self.assertThat(scoring_engines, HasLength(1)) self.assertThat(scoring_engines, matchers.HasLength(1))
def test_scoring_engines_list_pagination_no_limit(self): def test_scoring_engines_list_pagination_no_limit(self):
self.api = utils.FakeAPI(fake_responses_pagination) self.api = utils.FakeAPI(fake_responses_pagination)
@@ -145,7 +145,7 @@ class ScoringEngineManagerTest(testtools.TestCase):
('GET', '/v1/scoring_engines/?limit=1', {}, None) ('GET', '/v1/scoring_engines/?limit=1', {}, None)
] ]
self.assertEqual(expect, self.api.calls) self.assertEqual(expect, self.api.calls)
self.assertThat(scoring_engines, HasLength(2)) self.assertThat(scoring_engines, matchers.HasLength(2))
def test_scoring_engines_list_sort_key(self): def test_scoring_engines_list_sort_key(self):
self.api = utils.FakeAPI(fake_responses_sorting) self.api = utils.FakeAPI(fake_responses_sorting)

View File

@@ -17,7 +17,7 @@
import testtools import testtools
from testtools.matchers import HasLength from testtools import matchers
from watcherclient.tests import utils from watcherclient.tests import utils
import watcherclient.v1.strategy import watcherclient.v1.strategy
@@ -134,7 +134,7 @@ class StrategyManagerTest(testtools.TestCase):
('GET', '/v1/strategies/?limit=1', {}, None), ('GET', '/v1/strategies/?limit=1', {}, None),
] ]
self.assertEqual(expect, self.api.calls) self.assertEqual(expect, self.api.calls)
self.assertThat(strategies, HasLength(1)) self.assertThat(strategies, matchers.HasLength(1))
def test_strategies_list_pagination_no_limit(self): def test_strategies_list_pagination_no_limit(self):
self.api = utils.FakeAPI(fake_responses_pagination) self.api = utils.FakeAPI(fake_responses_pagination)
@@ -145,7 +145,7 @@ class StrategyManagerTest(testtools.TestCase):
('GET', '/v1/strategies/?limit=1', {}, None) ('GET', '/v1/strategies/?limit=1', {}, None)
] ]
self.assertEqual(expect, self.api.calls) self.assertEqual(expect, self.api.calls)
self.assertThat(strategies, HasLength(2)) self.assertThat(strategies, matchers.HasLength(2))
def test_strategies_list_sort_key(self): def test_strategies_list_sort_key(self):
self.api = utils.FakeAPI(fake_responses_sorting) self.api = utils.FakeAPI(fake_responses_sorting)