Replace test.attr with decorators.attr
Function 'tempest.test.attr()' has moved to 'tempest.lib.decorators
.attr()' in Pike and will be removed in a future version.
This patch replaces the 'tempest.test.attr()' with the 'tempest.lib
.decorators.attr().'
Change-Id: I672fbce15ea9b70d977eb0073426c394a1318b86
diff --git a/manila_tempest_tests/tests/api/admin/test_user_messages.py b/manila_tempest_tests/tests/api/admin/test_user_messages.py
index 1d23487..30e40be 100644
--- a/manila_tempest_tests/tests/api/admin/test_user_messages.py
+++ b/manila_tempest_tests/tests/api/admin/test_user_messages.py
@@ -13,7 +13,7 @@
from oslo_utils import timeutils
from oslo_utils import uuidutils
from tempest import config
-from tempest import test
+from tempest.lib import decorators
from manila_tempest_tests.tests.api import base
@@ -43,7 +43,7 @@
super(UserMessageTest, self).setUp()
self.message = self.create_user_message()
- @test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
+ @decorators.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_messages(self):
body = self.shares_v2_client.list_messages()
self.assertIsInstance(body, list)
@@ -51,7 +51,7 @@
message = body[0]
self.assertEqual(set(MESSAGE_KEYS), set(message.keys()))
- @test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
+ @decorators.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_messages_sorted_and_paginated(self):
self.create_user_message()
self.create_user_message()
@@ -68,7 +68,7 @@
self.assertEqual(2, len(ids))
self.assertEqual(ids, sorted(ids))
- @test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
+ @decorators.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_messages_filtered(self):
self.create_user_message()
params = {'resource_id': self.message['resource_id']}
@@ -77,7 +77,7 @@
ids = [x['id'] for x in body]
self.assertEqual([self.message['id']], ids)
- @test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
+ @decorators.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_show_message(self):
self.addCleanup(self.shares_v2_client.delete_message,
self.message['id'])
@@ -96,7 +96,7 @@
self.assertGreater(expires_at, created_at)
self.assertEqual(set(MESSAGE_KEYS), set(message.keys()))
- @test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
+ @decorators.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_delete_message(self):
self.shares_v2_client.delete_message(self.message['id'])
self.shares_v2_client.wait_for_resource_deletion(
diff --git a/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py b/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py
index 47eed3b..ccca166 100644
--- a/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py
@@ -12,8 +12,8 @@
from oslo_utils import uuidutils
import six
from tempest import config
+from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
-from tempest import test
from manila_tempest_tests.tests.api import base
@@ -29,7 +29,7 @@
super(UserMessageNegativeTest, self).setUp()
self.message = self.create_user_message()
- @test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
+ @decorators.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_show_message_of_other_tenants(self):
isolated_client = self.get_client_with_isolated_creds(
type_of_creds='alt', client_version='2')
@@ -37,13 +37,13 @@
isolated_client.get_message,
self.message['id'])
- @test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
+ @decorators.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_show_nonexistent_message(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.get_message,
six.text_type(uuidutils.generate_uuid()))
- @test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
+ @decorators.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_delete_message_of_other_tenants(self):
isolated_client = self.get_client_with_isolated_creds(
type_of_creds='alt', client_version='2')
@@ -51,7 +51,7 @@
isolated_client.delete_message,
self.message['id'])
- @test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
+ @decorators.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_delete_nonexistent_message(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.delete_message,