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[1].
This patch replaces the 'tempest.test.attr()' with the 'tempest.lib
.decorators.attr().'

[1] Iaafbb112b6eee458089cc49918359a8a8d0485e2

Change-Id: Ia9bf03fab71066a5fe8d7653fc62a0918e347136
This commit is contained in:
Dobroslaw Zybort 2017-05-19 06:56:17 +02:00
parent 3a96cfeef6
commit 9018920493
2 changed files with 19 additions and 19 deletions

View File

@ -1,4 +1,4 @@
# Copyright 2015 FUJITSU LIMITED
# Copyright 2015-2017 FUJITSU LIMITED
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -12,14 +12,14 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest import test
from tempest.lib import decorators
from tempest.lib import exceptions
from monasca_log_api_tempest.tests import base
class TestLogApiConstraints(base.BaseLogsTestCase):
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_should_reject_if_body_is_empty(self):
headers = base._get_headers()
for cli in self.logs_clients.itervalues():
@ -31,7 +31,7 @@ class TestLogApiConstraints(base.BaseLogsTestCase):
self.assertTrue(False, 'API should respond with 411')
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_should_reject_if_content_type_missing(self):
headers = base._get_headers(content_type='')
for cli in self.logs_clients.itervalues():
@ -43,7 +43,7 @@ class TestLogApiConstraints(base.BaseLogsTestCase):
self.assertTrue(False, 'API should respond with 400')
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_should_reject_if_wrong_content_type(self):
headers = base._get_headers(content_type='video/3gpp')
for cli in self.logs_clients.itervalues():
@ -55,7 +55,7 @@ class TestLogApiConstraints(base.BaseLogsTestCase):
self.assertTrue(False, 'API should respond with 400')
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_should_reject_too_big_message(self):
_, message = base.generate_rejectable_message()
headers = base._get_headers(self.logs_clients["v3"].get_headers())
@ -76,7 +76,7 @@ class TestLogApiConstraints(base.BaseLogsTestCase):
self.assertTrue(False, 'API should respond with 413')
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_should_reject_too_big_message_multiline(self):
_, message = base.generate_rejectable_message()
message = message.replace(' ', '\n')

View File

@ -1,4 +1,4 @@
# Copyright 2015 FUJITSU LIMITED
# Copyright 2015-2017 FUJITSU LIMITED
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -13,7 +13,7 @@
# under the License.
from tempest.lib.common.utils import test_utils
from tempest import test
from tempest.lib import decorators
from monasca_log_api_tempest.tests import base
@ -45,40 +45,40 @@ class TestSingleLog(base.BaseLogsTestCase):
return response
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_small_message(self):
for ver in self.logs_clients:
self._run_and_wait(*base.generate_small_message(), version=ver)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_medium_message(self):
for ver in self.logs_clients:
self._run_and_wait(*base.generate_medium_message(), version=ver)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_big_message(self):
for ver in self.logs_clients:
self._run_and_wait(*base.generate_large_message(), version=ver)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_small_message_multiline(self):
for ver in self.logs_clients:
sid, message = base.generate_small_message()
self._run_and_wait(sid, message.replace(' ', '\n'), version=ver)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_medium_message_multiline(self):
for ver in self.logs_clients:
sid, message = base.generate_medium_message()
self._run_and_wait(sid, message.replace(' ', '\n'), version=ver)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_big_message_multiline(self):
for ver in self.logs_clients:
sid, message = base.generate_large_message()
self._run_and_wait(sid, message.replace(' ', '\n'), version=ver)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_send_header_application_type(self):
sid, message = base.generate_unique_message()
headers = {'X-Application-Type': 'application-type-test'}
@ -87,7 +87,7 @@ class TestSingleLog(base.BaseLogsTestCase):
self.assertEqual('application-type-test',
response[0]['_source']['component'])
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_send_header_dimensions(self):
sid, message = base.generate_unique_message()
headers = {'X-Dimensions':
@ -100,7 +100,7 @@ class TestSingleLog(base.BaseLogsTestCase):
# TODO(trebski) following test not passing - failed to retrieve
# big message from elasticsearch
# @test.attr(type='gate')
# @decorators.attr(type='gate')
# def test_should_truncate_big_message(self):
# message_size = base._get_message_size(0.9999)
# sid, message = base.generate_unique_message(size=message_size)