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
This commit is contained in:
committed by
Tuan Luong-Anh
parent
fda6de272e
commit
4d3b9c6774
@@ -13,7 +13,7 @@
|
|||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
from tempest import config
|
from tempest import config
|
||||||
from tempest import test
|
from tempest.lib import decorators
|
||||||
|
|
||||||
from manila_tempest_tests.tests.api import base
|
from manila_tempest_tests.tests.api import base
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ class UserMessageTest(base.BaseSharesAdminTest):
|
|||||||
super(UserMessageTest, self).setUp()
|
super(UserMessageTest, self).setUp()
|
||||||
self.message = self.create_user_message()
|
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):
|
def test_list_messages(self):
|
||||||
body = self.shares_v2_client.list_messages()
|
body = self.shares_v2_client.list_messages()
|
||||||
self.assertIsInstance(body, list)
|
self.assertIsInstance(body, list)
|
||||||
@@ -51,7 +51,7 @@ class UserMessageTest(base.BaseSharesAdminTest):
|
|||||||
message = body[0]
|
message = body[0]
|
||||||
self.assertEqual(set(MESSAGE_KEYS), set(message.keys()))
|
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):
|
def test_list_messages_sorted_and_paginated(self):
|
||||||
self.create_user_message()
|
self.create_user_message()
|
||||||
self.create_user_message()
|
self.create_user_message()
|
||||||
@@ -68,7 +68,7 @@ class UserMessageTest(base.BaseSharesAdminTest):
|
|||||||
self.assertEqual(2, len(ids))
|
self.assertEqual(2, len(ids))
|
||||||
self.assertEqual(ids, sorted(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):
|
def test_list_messages_filtered(self):
|
||||||
self.create_user_message()
|
self.create_user_message()
|
||||||
params = {'resource_id': self.message['resource_id']}
|
params = {'resource_id': self.message['resource_id']}
|
||||||
@@ -77,7 +77,7 @@ class UserMessageTest(base.BaseSharesAdminTest):
|
|||||||
ids = [x['id'] for x in body]
|
ids = [x['id'] for x in body]
|
||||||
self.assertEqual([self.message['id']], ids)
|
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):
|
def test_show_message(self):
|
||||||
self.addCleanup(self.shares_v2_client.delete_message,
|
self.addCleanup(self.shares_v2_client.delete_message,
|
||||||
self.message['id'])
|
self.message['id'])
|
||||||
@@ -96,7 +96,7 @@ class UserMessageTest(base.BaseSharesAdminTest):
|
|||||||
self.assertGreater(expires_at, created_at)
|
self.assertGreater(expires_at, created_at)
|
||||||
self.assertEqual(set(MESSAGE_KEYS), set(message.keys()))
|
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):
|
def test_delete_message(self):
|
||||||
self.shares_v2_client.delete_message(self.message['id'])
|
self.shares_v2_client.delete_message(self.message['id'])
|
||||||
self.shares_v2_client.wait_for_resource_deletion(
|
self.shares_v2_client.wait_for_resource_deletion(
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
import six
|
import six
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
from tempest.lib import decorators
|
||||||
from tempest.lib import exceptions as lib_exc
|
from tempest.lib import exceptions as lib_exc
|
||||||
from tempest import test
|
|
||||||
|
|
||||||
from manila_tempest_tests.tests.api import base
|
from manila_tempest_tests.tests.api import base
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ class UserMessageNegativeTest(base.BaseSharesAdminTest):
|
|||||||
super(UserMessageNegativeTest, self).setUp()
|
super(UserMessageNegativeTest, self).setUp()
|
||||||
self.message = self.create_user_message()
|
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):
|
def test_show_message_of_other_tenants(self):
|
||||||
isolated_client = self.get_client_with_isolated_creds(
|
isolated_client = self.get_client_with_isolated_creds(
|
||||||
type_of_creds='alt', client_version='2')
|
type_of_creds='alt', client_version='2')
|
||||||
@@ -37,13 +37,13 @@ class UserMessageNegativeTest(base.BaseSharesAdminTest):
|
|||||||
isolated_client.get_message,
|
isolated_client.get_message,
|
||||||
self.message['id'])
|
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):
|
def test_show_nonexistent_message(self):
|
||||||
self.assertRaises(lib_exc.NotFound,
|
self.assertRaises(lib_exc.NotFound,
|
||||||
self.shares_v2_client.get_message,
|
self.shares_v2_client.get_message,
|
||||||
six.text_type(uuidutils.generate_uuid()))
|
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):
|
def test_delete_message_of_other_tenants(self):
|
||||||
isolated_client = self.get_client_with_isolated_creds(
|
isolated_client = self.get_client_with_isolated_creds(
|
||||||
type_of_creds='alt', client_version='2')
|
type_of_creds='alt', client_version='2')
|
||||||
@@ -51,7 +51,7 @@ class UserMessageNegativeTest(base.BaseSharesAdminTest):
|
|||||||
isolated_client.delete_message,
|
isolated_client.delete_message,
|
||||||
self.message['id'])
|
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):
|
def test_delete_nonexistent_message(self):
|
||||||
self.assertRaises(lib_exc.NotFound,
|
self.assertRaises(lib_exc.NotFound,
|
||||||
self.shares_v2_client.delete_message,
|
self.shares_v2_client.delete_message,
|
||||||
|
|||||||
Reference in New Issue
Block a user