Get all tests to use tests.base.TestCase
part of bug 1177924 Change-Id: If8124e2ca21bf9766adf770e30a630437c6fcd95
This commit is contained in:
committed by
Doug Hellmann
parent
65a83066f0
commit
06093adfaf
@@ -19,18 +19,19 @@
|
||||
"""
|
||||
import os
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.api.v1 import app
|
||||
from ceilometer.api import acl
|
||||
from ceilometer import service
|
||||
from ceilometer.tests import base
|
||||
|
||||
|
||||
class TestApp(unittest.TestCase):
|
||||
class TestApp(base.TestCase):
|
||||
|
||||
def tearDown(self):
|
||||
super(TestApp, self).tearDown()
|
||||
cfg.CONF.reset()
|
||||
|
||||
def test_keystone_middleware_conf(self):
|
||||
|
||||
@@ -19,19 +19,20 @@
|
||||
"""
|
||||
import os
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.api import app
|
||||
from ceilometer.api import acl
|
||||
from ceilometer import service
|
||||
from ceilometer.tests import base
|
||||
from .base import FunctionalTest
|
||||
|
||||
|
||||
class TestApp(unittest.TestCase):
|
||||
class TestApp(base.TestCase):
|
||||
|
||||
def tearDown(self):
|
||||
super(TestApp, self).tearDown()
|
||||
cfg.CONF.reset()
|
||||
|
||||
def test_keystone_middleware_conf(self):
|
||||
|
||||
@@ -20,14 +20,15 @@
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import unittest
|
||||
|
||||
from ceilometer.api.controllers import v2
|
||||
from ceilometer.tests import base
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TestStatisticsDuration(unittest.TestCase):
|
||||
class TestStatisticsDuration(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestStatisticsDuration, self).setUp()
|
||||
|
||||
@@ -18,12 +18,11 @@
|
||||
"""Tests for ceilometer.compute.instance
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
|
||||
from ceilometer.compute import instance
|
||||
from ceilometer.compute import manager
|
||||
from ceilometer.tests import base
|
||||
|
||||
|
||||
class FauxInstance(object):
|
||||
@@ -42,7 +41,7 @@ class FauxInstance(object):
|
||||
return default
|
||||
|
||||
|
||||
class TestLocationMetadata(unittest.TestCase):
|
||||
class TestLocationMetadata(base.TestCase):
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def setUp(self):
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
notification events.
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
from ceilometer.tests import base
|
||||
from ceilometer.compute import notifications
|
||||
from ceilometer import counter
|
||||
|
||||
@@ -352,7 +351,7 @@ INSTANCE_DELETE_SAMPLES = {
|
||||
}
|
||||
|
||||
|
||||
class TestNotifications(unittest.TestCase):
|
||||
class TestNotifications(base.TestCase):
|
||||
|
||||
def test_process_notification(self):
|
||||
info = notifications.Instance().process_notification(
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
# under the License.
|
||||
|
||||
from datetime import datetime
|
||||
import unittest
|
||||
|
||||
from ceilometer.image import notifications
|
||||
from ceilometer import counter
|
||||
from ceilometer.tests import base
|
||||
|
||||
|
||||
def fake_uuid(x):
|
||||
@@ -89,7 +89,7 @@ NOTIFICATION_DELETE = {"message_id": "0c65cb9c-018c-11e2-bc91-5453ed1bbb5f",
|
||||
"timestamp": NOW}
|
||||
|
||||
|
||||
class TestNotification(unittest.TestCase):
|
||||
class TestNotification(base.TestCase):
|
||||
|
||||
def _verify_common_counter(self, c, name, volume):
|
||||
self.assertFalse(c is None)
|
||||
|
||||
@@ -18,9 +18,8 @@
|
||||
"""Tests for ceilometer.network.notifications
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
from ceilometer.network import notifications
|
||||
from ceilometer.tests import base
|
||||
|
||||
NOTIFICATION_NETWORK_CREATE = {
|
||||
u'_context_roles': [u'anotherrole',
|
||||
@@ -204,7 +203,7 @@ NOTIFICATION_FLOATINGIP_EXISTS = {
|
||||
u'message_id': u'9e839576-cc47-4c60-a7d8-5743681213b1'}
|
||||
|
||||
|
||||
class TestNotifications(unittest.TestCase):
|
||||
class TestNotifications(base.TestCase):
|
||||
def test_network_create(self):
|
||||
v = notifications.Network()
|
||||
counters = list(v.process_notification(NOTIFICATION_NETWORK_CREATE))
|
||||
@@ -246,7 +245,7 @@ class TestNotifications(unittest.TestCase):
|
||||
self.assertEqual(counters[0].name, "ip.floating")
|
||||
|
||||
|
||||
class TestEventTypes(unittest.TestCase):
|
||||
class TestEventTypes(base.TestCase):
|
||||
|
||||
def test_network(self):
|
||||
v = notifications.Network()
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
# under the License.
|
||||
import datetime
|
||||
import math
|
||||
import unittest
|
||||
|
||||
from ceilometer.storage import base
|
||||
from ceilometer.tests import base as test_base
|
||||
|
||||
|
||||
class BaseTest(unittest.TestCase):
|
||||
class BaseTest(test_base.TestCase):
|
||||
|
||||
def test_iter_period(self):
|
||||
times = list(base.iter_period(
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import unittest
|
||||
|
||||
from ceilometer.storage import models
|
||||
from ceilometer.tests import base
|
||||
|
||||
|
||||
class FakeModel(models.Model):
|
||||
@@ -26,7 +25,7 @@ class FakeModel(models.Model):
|
||||
models.Model.__init__(self, arg1=arg1, arg2=arg2)
|
||||
|
||||
|
||||
class ModelTest(unittest.TestCase):
|
||||
class ModelTest(base.TestCase):
|
||||
|
||||
def test_create_attributes(self):
|
||||
m = FakeModel(1, 2)
|
||||
|
||||
@@ -25,11 +25,13 @@ import socket
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
import unittest
|
||||
|
||||
from ceilometer.tests import base
|
||||
|
||||
|
||||
class BinDbsyncTestCase(unittest.TestCase):
|
||||
class BinDbsyncTestCase(base.TestCase):
|
||||
def setUp(self):
|
||||
super(BinDbsyncTestCase, self).setUp()
|
||||
self.tempfile = tempfile.mktemp()
|
||||
with open(self.tempfile, 'w') as tmp:
|
||||
tmp.write("[DEFAULT]\n")
|
||||
@@ -41,11 +43,13 @@ class BinDbsyncTestCase(unittest.TestCase):
|
||||
self.assertEqual(subp.wait(), 0)
|
||||
|
||||
def tearDown(self):
|
||||
super(BinDbsyncTestCase, self).tearDown()
|
||||
os.unlink(self.tempfile)
|
||||
|
||||
|
||||
class BinSendCounterTestCase(unittest.TestCase):
|
||||
class BinSendCounterTestCase(base.TestCase):
|
||||
def setUp(self):
|
||||
super(BinSendCounterTestCase, self).setUp()
|
||||
self.tempfile = tempfile.mktemp()
|
||||
with open(self.tempfile, 'w') as tmp:
|
||||
tmp.write("[DEFAULT]\n")
|
||||
@@ -62,12 +66,14 @@ class BinSendCounterTestCase(unittest.TestCase):
|
||||
self.assertEqual(subp.wait(), 0)
|
||||
|
||||
def tearDown(self):
|
||||
super(BinSendCounterTestCase, self).tearDown()
|
||||
os.unlink(self.tempfile)
|
||||
|
||||
|
||||
class BinApiTestCase(unittest.TestCase):
|
||||
class BinApiTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(BinApiTestCase, self).setUp()
|
||||
self.api_port = random.randint(10000, 11000)
|
||||
self.http = httplib2.Http()
|
||||
self.tempfile = tempfile.mktemp()
|
||||
@@ -88,6 +94,7 @@ class BinApiTestCase(unittest.TestCase):
|
||||
"--config-file=%s" % self.tempfile])
|
||||
|
||||
def tearDown(self):
|
||||
super(BinApiTestCase, self).tearDown()
|
||||
os.unlink(self.tempfile)
|
||||
self.subp.kill()
|
||||
self.subp.wait()
|
||||
|
||||
@@ -34,6 +34,7 @@ class TestPolicy(base.TestCase):
|
||||
policy._POLICY_CACHE = {}
|
||||
|
||||
def tearDown(self):
|
||||
super(TestPolicy, self).tearDown()
|
||||
try:
|
||||
os.unlink(cfg.CONF.policy_file)
|
||||
except OSError:
|
||||
|
||||
@@ -17,11 +17,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import unittest
|
||||
|
||||
from ceilometer import service
|
||||
from ceilometer.tests import base
|
||||
|
||||
|
||||
class ServiceTestCase(unittest.TestCase):
|
||||
class ServiceTestCase(base.TestCase):
|
||||
def test_prepare_service(self):
|
||||
service.prepare_service()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import unittest
|
||||
|
||||
from ceilometer.volume import notifications
|
||||
from ceilometer.tests import base
|
||||
|
||||
NOTIFICATION_VOLUME_EXISTS = {
|
||||
u'_context_roles': [u'admin'],
|
||||
@@ -61,7 +60,7 @@ NOTIFICATION_VOLUME_DELETE = {
|
||||
u'priority': u'INFO'}
|
||||
|
||||
|
||||
class TestNotifications(unittest.TestCase):
|
||||
class TestNotifications(base.TestCase):
|
||||
|
||||
def _verify_common_counter(self, c, name, notification):
|
||||
self.assertFalse(c is None)
|
||||
|
||||
Reference in New Issue
Block a user