Remove the deprecated tempest.test.attr

[1] moves the attr decorator from test.py to tempest/lib. So, all the
references to tempest.test has to be moved to tempest.lib.decorator.

[2] https://review.openstack.org/#/c/456236/

Change-Id: If977e559d9f3b982baf2974efef3c5b375f263b9
This commit is contained in:
Ngo Quoc Cuong 2017-05-22 10:10:17 +07:00
parent 21994297cf
commit a4fac69d85
9 changed files with 60 additions and 60 deletions

View File

@ -20,7 +20,7 @@ import collections
import functools
from tempest.lib.common.utils import test_utils
from tempest import test
from tempest.lib import decorators
from watcher_tempest_plugin.tests.api.admin import base
@ -44,7 +44,7 @@ class TestShowListAction(base.BaseInfraOptimTest):
audit_uuid=cls.audit['uuid'])
cls.action_plan = action_plans['action_plans'][0]
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_one_action(self):
_, body = self.client.list_actions(
action_plan_uuid=self.action_plan["uuid"])
@ -55,7 +55,7 @@ class TestShowListAction(base.BaseInfraOptimTest):
self.assertEqual(self.action_plan["uuid"], action['action_plan_uuid'])
self.assertEqual("PENDING", action['state'])
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_action_with_links(self):
_, body = self.client.list_actions(
action_plan_uuid=self.action_plan["uuid"])
@ -67,7 +67,7 @@ class TestShowListAction(base.BaseInfraOptimTest):
self.assertEqual(2, len(action['links']))
self.assertIn(action['uuid'], action['links'][0]['href'])
@test.attr(type="smoke")
@decorators.attr(type="smoke")
def test_list_actions(self):
_, body = self.client.list_actions()
@ -76,7 +76,7 @@ class TestShowListAction(base.BaseInfraOptimTest):
self.validate_self_link('actions', action['uuid'],
action['links'][0]['href'])
@test.attr(type="smoke")
@decorators.attr(type="smoke")
def test_list_actions_by_action_plan(self):
_, body = self.client.list_actions(
action_plan_uuid=self.action_plan["uuid"])
@ -93,7 +93,7 @@ class TestShowListAction(base.BaseInfraOptimTest):
self.assertEqual(2, action_counter.get("nop"))
self.assertEqual(1, action_counter.get("sleep"))
@test.attr(type="smoke")
@decorators.attr(type="smoke")
def test_list_actions_by_audit(self):
_, body = self.client.list_actions(audit_uuid=self.audit["uuid"])

View File

@ -19,8 +19,8 @@ from __future__ import unicode_literals
import functools
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
from watcher_tempest_plugin.tests.api.admin import base
@ -28,7 +28,7 @@ from watcher_tempest_plugin.tests.api.admin import base
class TestCreateDeleteExecuteActionPlan(base.BaseInfraOptimTest):
"""Tests for action plans"""
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_create_action_plan(self):
_, goal = self.client.show_goal("dummy")
_, audit_template = self.create_audit_template(goal['uuid'])
@ -48,7 +48,7 @@ class TestCreateDeleteExecuteActionPlan(base.BaseInfraOptimTest):
self.assertEqual(audit['uuid'], action_plan['audit_uuid'])
self.assertEqual('RECOMMENDED', action_plan['state'])
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_delete_action_plan(self):
_, goal = self.client.show_goal("dummy")
_, audit_template = self.create_audit_template(goal['uuid'])
@ -70,7 +70,7 @@ class TestCreateDeleteExecuteActionPlan(base.BaseInfraOptimTest):
self.assertRaises(exceptions.NotFound, self.client.show_action_plan,
action_plan['uuid'])
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_execute_dummy_action_plan(self):
_, goal = self.client.show_goal("dummy")
_, audit_template = self.create_audit_template(goal['uuid'])
@ -126,14 +126,14 @@ class TestShowListActionPlan(base.BaseInfraOptimTest):
audit_uuid=cls.audit['uuid'])
cls.action_plan = action_plans['action_plans'][0]
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_action_plan(self):
_, action_plan = self.client.show_action_plan(
self.action_plan['uuid'])
self.assert_expected(self.action_plan, action_plan)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_action_plan_detail(self):
_, action_plans = self.client.list_action_plans_detail(
audit_uuid=self.audit['uuid'])
@ -142,7 +142,7 @@ class TestShowListActionPlan(base.BaseInfraOptimTest):
self.assert_expected(self.action_plan, action_plan)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_action_plan_with_links(self):
_, action_plan = self.client.show_action_plan(
self.action_plan['uuid'])
@ -151,7 +151,7 @@ class TestShowListActionPlan(base.BaseInfraOptimTest):
self.assertIn(action_plan['uuid'],
action_plan['links'][0]['href'])
@test.attr(type="smoke")
@decorators.attr(type="smoke")
def test_list_action_plans(self):
_, body = self.client.list_action_plans()
self.assertIn(self.action_plan['uuid'],
@ -161,7 +161,7 @@ class TestShowListActionPlan(base.BaseInfraOptimTest):
self.validate_self_link('action_plans', action_plan['uuid'],
action_plan['links'][0]['href'])
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_list_with_limit(self):
# We create 3 extra audits to exceed the limit we fix
for _ in range(3):

View File

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from tempest import test
from tempest.lib import decorators
from watcher_tempest_plugin.tests.api.admin import base
@ -22,7 +22,7 @@ from watcher_tempest_plugin.tests.api.admin import base
class TestApiDiscovery(base.BaseInfraOptimTest):
"""Tests for API discovery features."""
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_api_versions(self):
_, descr = self.client.get_api_description()
expected_versions = ('v1',)
@ -31,13 +31,13 @@ class TestApiDiscovery(base.BaseInfraOptimTest):
for v in expected_versions:
self.assertIn(v, versions)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_default_version(self):
_, descr = self.client.get_api_description()
default_version = descr['default_version']
self.assertEqual('v1', default_version['id'])
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_version_1_resources(self):
_, descr = self.client.get_version_description(version='v1')
expected_resources = ('audit_templates', 'audits', 'action_plans',

View File

@ -19,8 +19,8 @@ from __future__ import unicode_literals
import functools
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
from watcher_tempest_plugin.tests.api.admin import base
@ -37,7 +37,7 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest):
super(TestCreateUpdateDeleteAudit, self).assert_expected(
expected, actual, keys)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_create_audit_oneshot(self):
_, goal = self.client.show_goal("dummy")
_, audit_template = self.create_audit_template(goal['uuid'])
@ -55,7 +55,7 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest):
_, audit = self.client.show_audit(body['uuid'])
self.assert_expected(audit, body)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_create_audit_continuous(self):
_, goal = self.client.show_goal("dummy")
_, audit_template = self.create_audit_template(goal['uuid'])
@ -74,7 +74,7 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest):
_, audit = self.client.show_audit(body['uuid'])
self.assert_expected(audit, body)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_create_audit_with_wrong_audit_template(self):
audit_params = dict(
audit_template_uuid='INVALID',
@ -84,7 +84,7 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest):
self.assertRaises(
exceptions.BadRequest, self.create_audit, **audit_params)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_create_audit_with_invalid_state(self):
_, goal = self.client.show_goal("dummy")
_, audit_template = self.create_audit_template(goal['uuid'])
@ -97,7 +97,7 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest):
self.assertRaises(
exceptions.BadRequest, self.create_audit, **audit_params)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_create_audit_with_no_state(self):
_, goal = self.client.show_goal("dummy")
_, audit_template = self.create_audit_template(goal['uuid'])
@ -119,7 +119,7 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest):
self.assert_expected(audit, body)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_delete_audit(self):
_, goal = self.client.show_goal("dummy")
_, audit_template = self.create_audit_template(goal['uuid'])
@ -169,7 +169,7 @@ class TestShowListAudit(base.BaseInfraOptimTest):
super(TestShowListAudit, self).assert_expected(
expected, actual, keys)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_audit(self):
_, audit = self.client.show_audit(
self.audit['uuid'])
@ -183,7 +183,7 @@ class TestShowListAudit(base.BaseInfraOptimTest):
self.assertIn(audit_state, self.audit_states)
self.assert_expected(initial_audit, actual_audit)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_audit_with_links(self):
_, audit = self.client.show_audit(
self.audit['uuid'])
@ -192,7 +192,7 @@ class TestShowListAudit(base.BaseInfraOptimTest):
self.assertIn(audit['uuid'],
audit['links'][0]['href'])
@test.attr(type="smoke")
@decorators.attr(type="smoke")
def test_list_audits(self):
_, body = self.client.list_audits()
self.assertIn(self.audit['uuid'],
@ -202,7 +202,7 @@ class TestShowListAudit(base.BaseInfraOptimTest):
self.validate_self_link('audits', audit['uuid'],
audit['links'][0]['href'])
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_list_with_limit(self):
# We create 3 extra audits to exceed the limit we fix
for _ in range(3):
@ -214,7 +214,7 @@ class TestShowListAudit(base.BaseInfraOptimTest):
self.assertEqual(3, len(body['audits']))
self.assertIn(next_marker, body['next'])
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_list_audits_related_to_given_audit_template(self):
_, body = self.client.list_audits(
goal=self.goal['uuid'])

View File

@ -18,8 +18,8 @@ from __future__ import unicode_literals
from oslo_utils import uuidutils
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
from watcher_tempest_plugin.tests.api.admin import base
@ -27,7 +27,7 @@ from watcher_tempest_plugin.tests.api.admin import base
class TestCreateDeleteAuditTemplate(base.BaseInfraOptimTest):
"""Tests on audit templates"""
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_create_audit_template(self):
goal_name = "dummy"
_, goal = self.client.show_goal(goal_name)
@ -50,7 +50,7 @@ class TestCreateDeleteAuditTemplate(base.BaseInfraOptimTest):
_, audit_template = self.client.show_audit_template(body['uuid'])
self.assert_expected(audit_template, body)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_create_audit_template_unicode_description(self):
goal_name = "dummy"
_, goal = self.client.show_goal(goal_name)
@ -74,7 +74,7 @@ class TestCreateDeleteAuditTemplate(base.BaseInfraOptimTest):
_, audit_template = self.client.show_audit_template(body['uuid'])
self.assert_expected(audit_template, body)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_delete_audit_template(self):
_, goal = self.client.show_goal("dummy")
_, body = self.create_audit_template(goal=goal['uuid'])
@ -97,14 +97,14 @@ class TestAuditTemplate(base.BaseInfraOptimTest):
_, cls.audit_template = cls.create_audit_template(
goal=cls.goal['uuid'], strategy=cls.strategy['uuid'])
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_audit_template(self):
_, audit_template = self.client.show_audit_template(
self.audit_template['uuid'])
self.assert_expected(self.audit_template, audit_template)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_filter_audit_template_by_goal_uuid(self):
_, audit_templates = self.client.list_audit_templates(
goal=self.audit_template['goal_uuid'])
@ -113,7 +113,7 @@ class TestAuditTemplate(base.BaseInfraOptimTest):
at["uuid"] for at in audit_templates['audit_templates']]
self.assertIn(self.audit_template['uuid'], audit_template_uuids)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_filter_audit_template_by_strategy_uuid(self):
_, audit_templates = self.client.list_audit_templates(
strategy=self.audit_template['strategy_uuid'])
@ -122,7 +122,7 @@ class TestAuditTemplate(base.BaseInfraOptimTest):
at["uuid"] for at in audit_templates['audit_templates']]
self.assertIn(self.audit_template['uuid'], audit_template_uuids)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_audit_template_with_links(self):
_, audit_template = self.client.show_audit_template(
self.audit_template['uuid'])
@ -131,7 +131,7 @@ class TestAuditTemplate(base.BaseInfraOptimTest):
self.assertIn(audit_template['uuid'],
audit_template['links'][0]['href'])
@test.attr(type="smoke")
@decorators.attr(type="smoke")
def test_list_audit_templates(self):
_, body = self.client.list_audit_templates()
self.assertIn(self.audit_template['uuid'],
@ -141,7 +141,7 @@ class TestAuditTemplate(base.BaseInfraOptimTest):
self.validate_self_link('audit_templates', audit_template['uuid'],
audit_template['links'][0]['href'])
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_list_with_limit(self):
# We create 3 extra audit templates to exceed the limit we fix
for _ in range(3):
@ -153,7 +153,7 @@ class TestAuditTemplate(base.BaseInfraOptimTest):
self.assertEqual(3, len(body['audit_templates']))
self.assertIn(next_marker, body['next'])
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_update_audit_template_replace(self):
_, new_goal = self.client.show_goal("server_consolidation")
_, new_strategy = self.client.show_strategy("basic")
@ -188,7 +188,7 @@ class TestAuditTemplate(base.BaseInfraOptimTest):
self.assertEqual(new_goal['uuid'], body['goal_uuid'])
self.assertEqual(new_strategy['uuid'], body['strategy_uuid'])
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_update_audit_template_remove(self):
description = 'my at description'
name = 'my at name %s' % uuidutils.generate_uuid()
@ -211,7 +211,7 @@ class TestAuditTemplate(base.BaseInfraOptimTest):
self.assertIsNone(body['description'])
self.assertEqual(self.goal['uuid'], body['goal_uuid'])
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_update_audit_template_add(self):
params = {'name': 'my at name %s' % uuidutils.generate_uuid(),
'goal': self.goal['uuid']}

View File

@ -16,7 +16,7 @@
from __future__ import unicode_literals
from tempest import test
from tempest.lib import decorators
from watcher_tempest_plugin.tests.api.admin import base
@ -35,7 +35,7 @@ class TestShowListGoal(base.BaseInfraOptimTest):
super(TestShowListGoal, self).assert_expected(
expected, actual, keys)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_goal(self):
_, goal = self.client.show_goal(self.DUMMY_GOAL)
@ -46,7 +46,7 @@ class TestShowListGoal(base.BaseInfraOptimTest):
'updated_at', 'uuid'}
self.assertEqual(expected_fields, set(goal.keys()))
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_goal_with_links(self):
_, goal = self.client.show_goal(self.DUMMY_GOAL)
self.assertIn('links', goal.keys())
@ -54,7 +54,7 @@ class TestShowListGoal(base.BaseInfraOptimTest):
self.assertIn(goal['uuid'],
goal['links'][0]['href'])
@test.attr(type="smoke")
@decorators.attr(type="smoke")
def test_list_goals(self):
_, body = self.client.list_goals()
self.assertIn(self.DUMMY_GOAL,

View File

@ -15,7 +15,7 @@
from __future__ import unicode_literals
from tempest import test
from tempest.lib import decorators
from watcher_tempest_plugin.tests.api.admin import base
@ -34,7 +34,7 @@ class TestShowListScoringEngine(base.BaseInfraOptimTest):
super(TestShowListScoringEngine, self).assert_expected(
expected, actual, keys)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_scoring_engine(self):
_, scoring_engine = self.client.show_scoring_engine(
self.DUMMY_SCORING_ENGINE)
@ -44,7 +44,7 @@ class TestShowListScoringEngine(base.BaseInfraOptimTest):
expected_fields = {'metainfo', 'description', 'name', 'uuid', 'links'}
self.assertEqual(expected_fields, set(scoring_engine.keys()))
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_scoring_engine_with_links(self):
_, scoring_engine = self.client.show_scoring_engine(
self.DUMMY_SCORING_ENGINE)
@ -53,7 +53,7 @@ class TestShowListScoringEngine(base.BaseInfraOptimTest):
self.assertIn(scoring_engine['uuid'],
scoring_engine['links'][0]['href'])
@test.attr(type="smoke")
@decorators.attr(type="smoke")
def test_list_scoring_engines(self):
_, body = self.client.list_scoring_engines()
self.assertIn(self.DUMMY_SCORING_ENGINE,

View File

@ -16,7 +16,7 @@
from __future__ import unicode_literals
from tempest import test
from tempest.lib import decorators
from watcher_tempest_plugin.tests.api.admin import base
@ -36,7 +36,7 @@ class TestShowListService(base.BaseInfraOptimTest):
super(TestShowListService, self).assert_expected(
expected, actual, keys)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_service(self):
_, service = self.client.show_service(self.DECISION_ENGINE)
@ -45,7 +45,7 @@ class TestShowListService(base.BaseInfraOptimTest):
self.assertIn("last_seen_up", service.keys())
self.assertIn("status", service.keys())
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_service_with_links(self):
_, service = self.client.show_service(self.DECISION_ENGINE)
self.assertIn('links', service.keys())
@ -53,7 +53,7 @@ class TestShowListService(base.BaseInfraOptimTest):
self.assertIn(str(service['id']),
service['links'][0]['href'])
@test.attr(type="smoke")
@decorators.attr(type="smoke")
def test_list_services(self):
_, body = self.client.list_services()
self.assertIn('services', body)

View File

@ -16,7 +16,7 @@
from __future__ import unicode_literals
from tempest import test
from tempest.lib import decorators
from watcher_tempest_plugin.tests.api.admin import base
@ -35,14 +35,14 @@ class TestShowListStrategy(base.BaseInfraOptimTest):
super(TestShowListStrategy, self).assert_expected(
expected, actual, keys)
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_strategy(self):
_, strategy = self.client.show_strategy(self.DUMMY_STRATEGY)
self.assertEqual(self.DUMMY_STRATEGY, strategy['name'])
self.assertIn("display_name", strategy.keys())
@test.attr(type='smoke')
@decorators.attr(type='smoke')
def test_show_strategy_with_links(self):
_, strategy = self.client.show_strategy(self.DUMMY_STRATEGY)
self.assertIn('links', strategy.keys())
@ -50,7 +50,7 @@ class TestShowListStrategy(base.BaseInfraOptimTest):
self.assertIn(strategy['uuid'],
strategy['links'][0]['href'])
@test.attr(type="smoke")
@decorators.attr(type="smoke")
def test_list_strategies(self):
_, body = self.client.list_strategies()
self.assertIn('strategies', body)