From 4d3b9c677401b5611d13fe13783c73bda56148a3 Mon Sep 17 00:00:00 2001 From: Luong Anh Tuan Date: Tue, 18 Jul 2017 17:53:11 +0700 Subject: [PATCH] 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 --- .../tests/api/admin/test_user_messages.py | 12 ++++++------ .../tests/api/admin/test_user_messages_negative.py | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) 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 1d23487e..30e40be8 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 @@ class UserMessageTest(base.BaseSharesAdminTest): 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 @@ class UserMessageTest(base.BaseSharesAdminTest): 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 @@ class UserMessageTest(base.BaseSharesAdminTest): 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 @@ class UserMessageTest(base.BaseSharesAdminTest): 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 @@ class UserMessageTest(base.BaseSharesAdminTest): 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 47eed3b5..ccca1668 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 @@ class UserMessageNegativeTest(base.BaseSharesAdminTest): 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 @@ class UserMessageNegativeTest(base.BaseSharesAdminTest): 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 @@ class UserMessageNegativeTest(base.BaseSharesAdminTest): 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,