Replace direct use of testtools BaseTestCase.

Using the BaseTestCase across the tests in the tree lets us put in log
fixtures and consistently handle mox and stubout.

Part of blueprint grizzly-testtools.

Change-Id: Iba7eb2c63b0c514009b2c28e5930b27726a147b0
This commit is contained in:
Monty Taylor 2013-01-23 09:59:46 -05:00
parent c621d786b7
commit da85e9dee2
5 changed files with 23 additions and 23 deletions

View File

@ -14,12 +14,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.common import excutils
from tests import utils
class SaveAndReraiseTest(testtools.TestCase):
class SaveAndReraiseTest(utils.BaseTestCase):
def test_save_and_reraise_exception(self):
e = None

View File

@ -17,12 +17,12 @@
import datetime
import sys
import testtools
from openstack.common import importutils
from tests import utils
class ImportUtilsTest(testtools.TestCase):
class ImportUtilsTest(utils.BaseTestCase):
# NOTE(jkoelker) There has GOT to be a way to test this. But mocking
# __import__ is the devil. Right now we just make

View File

@ -15,28 +15,30 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
import mock
from openstack.common import network_utils as utils
from openstack.common import network_utils
from tests import utils
class NetworkUtilsTest(testtools.TestCase):
class NetworkUtilsTest(utils.BaseTestCase):
def test_parse_host_port(self):
self.assertEqual(('server01', 80),
utils.parse_host_port('server01:80'))
network_utils.parse_host_port('server01:80'))
self.assertEqual(('server01', None),
utils.parse_host_port('server01'))
network_utils.parse_host_port('server01'))
self.assertEqual(('server01', 1234),
utils.parse_host_port('server01', default_port=1234))
network_utils.parse_host_port('server01',
default_port=1234))
self.assertEqual(('::1', 80),
utils.parse_host_port('[::1]:80'))
network_utils.parse_host_port('[::1]:80'))
self.assertEqual(('::1', None),
utils.parse_host_port('[::1]'))
network_utils.parse_host_port('[::1]'))
self.assertEqual(('::1', 1234),
utils.parse_host_port('[::1]', default_port=1234))
network_utils.parse_host_port('[::1]',
default_port=1234))
self.assertEqual(('2001:db8:85a3::8a2e:370:7334', 1234),
utils.parse_host_port('2001:db8:85a3::8a2e:370:7334',
default_port=1234))
network_utils.parse_host_port(
'2001:db8:85a3::8a2e:370:7334',
default_port=1234))

View File

@ -15,15 +15,14 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
import mock
from openstack.common import exception
from openstack.common import strutils
from tests import utils
class StrUtilsTest(testtools.TestCase):
class StrUtilsTest(utils.BaseTestCase):
def test_bool_bool_from_string(self):
self.assertTrue(strutils.bool_from_string(True))

View File

@ -20,12 +20,12 @@ import datetime
import iso8601
import mock
import testtools
from openstack.common import timeutils
from tests import utils
class TimeUtilsTest(testtools.TestCase):
class TimeUtilsTest(utils.BaseTestCase):
def setUp(self):
super(TimeUtilsTest, self).setUp()
@ -155,7 +155,7 @@ class TimeUtilsTest(testtools.TestCase):
self.assertEqual(iso, timeutils.iso8601_from_timestamp(ts))
class TestIso8601Time(testtools.TestCase):
class TestIso8601Time(utils.BaseTestCase):
def _instaneous(self, timestamp, yr, mon, day, hr, min, sec, micro):
self.assertEquals(timestamp.year, yr)