Replace tests.base part5
It is the fifth step to replace using ceilometer.tests.base with openstack.common.test. In this patch is changed for using openstack.common.test and added needed fixtures in test classes. Change-Id: Ic7bed465f499f8546b86899f3345001bd16a9193
This commit is contained in:
parent
ab5bbdd957
commit
fd5a3db0ce
@ -15,9 +15,8 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.tests import base
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer import middleware
|
||||
|
||||
|
||||
@ -67,7 +66,12 @@ HTTP_RESPONSE = {
|
||||
}
|
||||
|
||||
|
||||
class TestNotifications(base.TestCase):
|
||||
class TestNotifications(test.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestNotifications, self).setUp()
|
||||
self.CONF = self.useFixture(config.Config()).conf
|
||||
|
||||
def test_process_request_notification(self):
|
||||
sample = list(middleware.HTTPRequest().process_notification(
|
||||
HTTP_REQUEST
|
||||
@ -97,5 +101,5 @@ class TestNotifications(base.TestCase):
|
||||
self.assertEqual(sample.volume, 1)
|
||||
|
||||
def test_exchanges(self):
|
||||
topics = middleware.HTTPRequest().get_exchange_topics(cfg.CONF)
|
||||
topics = middleware.HTTPRequest().get_exchange_topics(self.CONF)
|
||||
self.assertEqual(len(topics), 4)
|
||||
|
@ -21,7 +21,7 @@
|
||||
from ceilometer import notifier
|
||||
from ceilometer import pipeline
|
||||
from ceilometer import transformer
|
||||
from ceilometer.tests import base as tests_base
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
MESSAGE = {
|
||||
@ -64,7 +64,7 @@ MESSAGE = {
|
||||
}
|
||||
|
||||
|
||||
class TestNotifier(tests_base.TestCase):
|
||||
class TestNotifier(test.BaseTestCase):
|
||||
|
||||
def test_process_notification(self):
|
||||
transformer_manager = transformer.TransformerExtensionManager(
|
||||
|
@ -20,15 +20,17 @@
|
||||
import mock
|
||||
|
||||
import novaclient
|
||||
from ceilometer.tests import base
|
||||
from ceilometer import nova_client
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.openstack.common.fixture import moxstubout
|
||||
|
||||
|
||||
class TestNovaClient(base.TestCase):
|
||||
class TestNovaClient(test.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestNovaClient, self).setUp()
|
||||
self.nv = nova_client.Client()
|
||||
self.stubs = self.useFixture(moxstubout.MoxStubout()).stubs
|
||||
self.stubs.Set(self.nv.nova_client.flavors, 'get',
|
||||
self.fake_flavors_get)
|
||||
self.stubs.Set(self.nv.nova_client.images, 'get', self.fake_images_get)
|
||||
|
@ -27,12 +27,13 @@ from ceilometer.publisher import test as test_publisher
|
||||
from ceilometer import transformer
|
||||
from ceilometer.transformer import accumulator
|
||||
from ceilometer.transformer import conversions
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer.openstack.common import timeutils
|
||||
from ceilometer.openstack.common.fixture import moxstubout
|
||||
from ceilometer import pipeline
|
||||
from ceilometer.tests import base
|
||||
|
||||
|
||||
class TestTransformerAccumulator(base.TestCase):
|
||||
class TestTransformerAccumulator(test.BaseTestCase):
|
||||
|
||||
def test_handle_sample(self):
|
||||
test_sample = sample.Sample(
|
||||
@ -57,7 +58,7 @@ class TestTransformerAccumulator(base.TestCase):
|
||||
self.assertEqual(len(tf.samples), 1)
|
||||
|
||||
|
||||
class TestPipeline(base.TestCase):
|
||||
class TestPipeline(test.BaseTestCase):
|
||||
def fake_tem_init(self):
|
||||
"""Fake a transformerManager for pipeline
|
||||
The faked entry point setting is below:
|
||||
@ -148,6 +149,7 @@ class TestPipeline(base.TestCase):
|
||||
resource_metadata={}
|
||||
)
|
||||
|
||||
self.stubs = self.useFixture(moxstubout.MoxStubout()).stubs
|
||||
self.stubs.Set(transformer.TransformerExtensionManager,
|
||||
"__init__",
|
||||
self.fake_tem_init)
|
||||
|
@ -17,7 +17,7 @@
|
||||
# under the License.
|
||||
|
||||
from ceilometer import plugin
|
||||
from ceilometer.tests import base
|
||||
from ceilometer.openstack.common import test
|
||||
|
||||
|
||||
TEST_NOTIFICATION = {
|
||||
@ -70,7 +70,7 @@ TEST_NOTIFICATION = {
|
||||
}
|
||||
|
||||
|
||||
class NotificationBaseTestCase(base.TestCase):
|
||||
class NotificationBaseTestCase(test.BaseTestCase):
|
||||
def test_handle_event_type(self):
|
||||
self.assertFalse(plugin.NotificationBase._handle_event_type(
|
||||
'compute.instance.start', ['compute']))
|
||||
|
@ -22,11 +22,11 @@
|
||||
import decimal
|
||||
import datetime
|
||||
|
||||
from ceilometer.tests import base as tests_base
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer import utils
|
||||
|
||||
|
||||
class TestUtils(tests_base.TestCase):
|
||||
class TestUtils(test.BaseTestCase):
|
||||
|
||||
def test_datetime_to_decimal(self):
|
||||
expected = 1356093296.12
|
||||
|
Loading…
Reference in New Issue
Block a user